Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

AddressValidation container

The AddressValidation container displays a suggested shipping address (from a third-party verification service) alongside the entered address, allowing shoppers to choose between them.

Typically invoked from a modal during address creation after calling your address verification service.

AddressValidation configurations

The AddressValidation container provides the following configuration options:

Option Type Req? Description
originalAddressCustomerAddressesModel | nullYes Original address set by the user.
suggestedAddressPartial<CustomerAddressesModel> | nullYes Address suggestion to present to the user.
handleSelectedAddressfunctionNo Async callback fired when the shopper selects an address. Receives the selection and the chosen address.

AddressValidationProps interface

The AddressValidation container receives an object that implements the following interface:

interface AddressValidationProps {
selectedAddress?: 'suggested' | 'original' | null;
suggestedAddress: Partial<CustomerAddressesModel> | null;
originalAddress: CustomerAddressesModel | null;
handleSelectedAddress?: (payload: {
selection: 'suggested' | 'original';
address: CustomerAddressesModel | null | undefined;
}) => void;
}

CustomerAddressesModel type

The CustomerAddressesModel type has this shape:

interface CustomerAddressesModel {
city?: string;
countryCode?: string;
region?: { region: string; regionCode: string; regionId: string | number };
postcode?: string;
street?: string;
}

Example

For a complete walkthrough, see the Validate address tutorial.