Command Palette

Search for a command to run...

Set Up Address Autocomplete

In this guide, you'll learn how to enable the storefront's built-in DaData address autocomplete for checkout, or add a provider of your own for another country or service.

Address input on the checkout's address step is a pluggable provider, not a fixed set of fields. The storefront ships one real provider, DaData for Russian addresses, plus a plain address field as the fallback and a manual entry mode the buyer can switch to at any point.

How Provider Selection Works

reads the active provider from an environment variable and switches on it:

src/modules/common/components/address-autocomplete/index.tsx
1const renderAutocomplete = () => {
2 switch (true) {
3 case isDaData(addressAutocompleteProvider):
4 return <DaDataAddressInput {...props} />
5 default:
6 return <PlainAddressInput {...props} />
7 }
8}

and both come from . Any value other than , including an unset variable, falls through to (), which renders a single address field with no autocomplete at all.

Whichever provider is active, also renders a checkbox that lets the visitor switch to manual entry immediately. The checkbox swaps the provider for , four plain inputs for address, postal code, city, and province. As a result, autocomplete never blocks someone whose address doesn't match what the provider expects.

Enable the Built-In DaData Provider

Set two environment variables in :

apps/storefront/.env.local
1NEXT_PUBLIC_ADDRESS_AUTOCOMPLETE_PROVIDER=dadata
2NEXT_PUBLIC_ADDRESS_AUTOCOMPLETE_PROVIDER_API_KEY=

Get the API key from your DaData account. () passes it directly to 's component, which only suggests Russian addresses.

Add a Provider for Another Country

Every provider component takes the same props, in, out:

src/modules/common/components/address-autocomplete/types.ts
1export type AddressFields = {
2 address_1: string
3 postal_code: string
4 city: string
5 province: string
6}
7
8export type AddressAutocompleteProps = {
9 values: AddressFields
10 onChange: (fields: AddressFields) => void
11 required?: boolean
12}

To add a provider for another country or service:

  1. Create a file under , implementing , that calls with an object whenever the visitor picks a suggestion.
  2. Add a for it in the switch shown above, alongside a small helper next to in .
  3. Point at the id your and helper check for.

You can model a new provider's props and calls on , a working, minimal example. It doesn't call any external API itself.

References

Edited Aug 21, 2026·Edit this page