Reference implementation for integrating Address Capture, Address Verify, Email and Phone Validation with commercetools Frontend checkout, My Account and registration.
The Loqate commercetools plugin (loqate-commercetools) integrates the commercetools platform with the Loqate API to provide Address Capture, Address Verify, Email Validation and Phone Validation in the Checkout, My Account and Registration flows.The modifications are applied in two areas:
Backend-for-frontend (BFF): commercetools extensions that make the Loqate API calls and handle the responses
Frontend: React components that display the Loqate features to your customers
The plugin is a reference implementation built on the commercetools Frontend B2C template (latest as of 3 June 2024). It is not intended to be cloned and used as-is in production. Copy the relevant parts into your own implementation instead. See Disclaimers for details.
Address Verify evaluates the validity of the address on form submission, using fields like country, city, postal code and street address. Based on the response, the address is scored as Good, Questionable or Invalid using the Address Verification Code:
Good: no issues detected
Questionable: the user is prompted to accept a corrected address suggested by Address Verify. The user can either edit the address manually or proceed with the initial input
Invalid: a suggestion is provided to update the address. The user can either update it or proceed with the original input
Configuration options:
LOQATE_ADDRESS_VERIFICATION_CHECKOUT - toggle for address verification during checkout
LOQATE_ADDRESS_VERIFICATION_MY_ACCOUNT - toggle for address verification on the My Account page
LOQATE_AVC - minimum matchscore threshold for an address to be considered Good
Email Validation verifies the user’s email address during input, ensuring the format is correct and that the address is valid.Configuration options:
LOQATE_EMAIL_VALIDATION_CHECKOUT - toggle for email validation during checkout
LOQATE_EMAIL_VALIDATION_MY_ACCOUNT - toggle for email validation on the My Account page
LOQATE_EMAIL_VALIDATION_REGISTRATION - toggle for email validation during registration
LOQATE_EMAIL_VALIDATION_TIMEOUT_MILLISECONDS - timeout duration for email validation requests
LOQATE_INCLUDE_VALID_CATCHALL_EMAILS - determines whether Valid_CatchAll responses are considered valid (see the ResponseCode response field in the API documentation)
Phone Validation checks the correctness of the phone number the user enters, ensuring it is properly formatted and valid.Configuration options:
LOQATE_PHONE_VALIDATION_CHECKOUT - toggle for phone validation during checkout
LOQATE_PHONE_VALIDATION_MY_ACCOUNT - toggle for phone validation on the My Account page
LOQATE_PHONE_VALIDATION_REGISTRATION - toggle for phone validation during registration
LOQATE_INCLUDE_MAYBE_PHONE_NUMBERS - determines whether the Maybe validation state is treated as valid (see the IsValid response field in the API documentation)
The loqate-commercetools repository demonstrates the integration of Loqate Address Capture, Address Verify, Email Validation and Phone Validation features with commercetools. It is to be used as a reference implementation for your own integration - it is not intended to be used as is in a production environment. Please refer to the Setup Guide for instructions on the changes required to carry over the Loqate commercetools integration into your own project.It uses the commercetools Frontend B2C template as a base, specifically the latest as of 3 June 2024.This plugin:
Does not aim to keep up with the latest changes in the commercetools frontend template, but rather to provide a reference implementation
Should not be cloned and used as is in a production environment. It is recommended to use it as a reference and adapt it to your own needs by copying the relevant parts of the code and applying them to the merchant’s implementation
Does not aim to fix any bugs or issues in the commercetools frontend template. If you encounter any issues related with the B2C Frontend Template, please refer to the commercetools documentation
Is not responsible for any bugs or issues coming from the commercetools B2C Frontend Template, nor any customizations made to it and does not aim to fix them. You should refer to the commercetools documentation for support for any issues related to the specific version of the commercetools B2C Frontend Template that you are using
Does not take an opinion of the flow you should support in your store - it applies changes to the out of the box checkout, my account and registration flows
No. The plugin is a reference implementation. Get the latest version of the commercetools B2C Frontend template and apply the backend-for-frontend and frontend changes described in the setup guide on top of your existing implementation.
What do I need before I start?
Node.js 18.16.0 or higher, Yarn 1.22.19 or higher, a commercetools project, commercetools Frontend Studio, and a Loqate API key.
Which parts of my store does it change?
The plugin modifies the out-of-the-box Checkout, My Account and Registration flows. It doesn’t take an opinion on which flows you should support in your store.
Can I turn individual features on and off?
Yes. Each feature can be toggled per area through the project settings. See Studio settings for the full list.