Skip to content

Address validation and auto-completion

Address validation and autocomplete can be implemented with Hyvä Checkout.
Several modules and extensions are available.

The implementations can be roughly sorted into two different categories:

  • Backend PHP-based implementations using Magewire
  • Frontend JavaScript-based implementations (often built with a vendor-supplied SDK)

Current State

At the time of writing (Hyvä Checkout 1.1.11), implementing frontend-only address validation is not the preferred way, because the address form auto-save may re-render the form while JavaScript is interacting with it.
To work around this, the auto-save feature needs to be disabled.

Desired State

Hyvä Checkout is committed to providing stable APIs for integrations based on either JavaScript or PHP.
The upcoming 1.2.0 release will simplify JavaScript-based integrations, and we will continue to make integrating services more fun with further releases.

Example Modules

There are a couple of modules and extensions that can be used as an example to follow for custom implementations for Hyvä Checkout 1.1.x:

  • The PostCode NL integration can be used as an example for a server-side implementation.
  • The Loqate integration uses JavaScript (It is not released yet, but the address-validation branch is close).

When version 1.2.0 of Hyvä Checkout is released, we will update the documentation to cover the new API and also provide a frontend reference implementation.

Implementation

When implementing address validation of autocompletion, we recommend you study the existing modules and choose one that is the most similar to the service to be implemented.
Then use the existing code as a base for your own, adjusting what is needed.