Shopify Checkout Address Autocomplete: Bring Your Own

Shopify checkout address autocomplete is on by default for every merchant in 23 countries, the United Kingdom included. Replacing it with your own provider (Loqate, HERE, Google Places, an in-house address database), or covering a country Shopify does not, needs two things. The store must be on Shopify Plus, and you build a checkout UI extension on two targets: purchase.address-autocomplete.suggest and, optionally, purchase.address-autocomplete.format-suggestion.

This post works against checkout UI extensions API version 2026-10, the latest stable version on Shopify’s versioning page as of November 2026, and @shopify/ui-extensions 2026.10.2.

Do you need a custom address provider at all?

Start with the address collection settings. Shopify’s built-in autocomplete covers Australia, Austria, Belgium, Brazil, Canada, Denmark, France, Germany, Hong Kong SAR, India, Italy, Japan, Luxembourg, the Netherlands, New Zealand, Norway, Saudi Arabia, Singapore, Spain, Sweden, Switzerland, the UK and the US. The help centre says it “is available to all Shopify merchants and is active by default”. Only Plus stores can install a third-party autocompletion app, and the autocomplete tutorial states that checkout UI extensions are available only to Plus merchants (our Plus vs Advanced comparison covers what else that plan buys).

So a UK store selling mostly to the UK and Europe already has autocomplete. Building your own is worth it in a few specific cases:

  • You ship to countries outside that list, and failed or misdelivered parcels there cost real money.
  • You already pay for an address service elsewhere (a warehouse system, a call-centre order form) and want checkout to return the same normalised addresses.
  • You need coordinates. The extension can return latitude and longitude with the address, which the address targets reference suggests for delivery routing, zone pricing or time-in-transit estimates.

If none of those apply, leave the default on. A custom provider puts a request to your server behind every debounced query, adds the provider’s bill, and brings a protected customer data request with it.

How do the suggest and format-suggestion targets split the work?

Both targets are non-rendering JavaScript extensions. They take buyer input and return data, and the checkout draws the dropdown itself. If you use both, they must live in the same shopify.extension.toml.

purchase.address-autocomplete.suggest runs as the buyer types in the first field of the address form. Depending on the country that field is either address1 or zip, and the target tells you which in shopify.target.field, alongside value, selectedCountryCode and acceptedAddressInputFields. You return up to five suggestions; the type definitions say extra ones are ignored. Each needs a label, which Shopify shows exactly as you send it without parsing. matchedSubstrings (offset and length pairs into the label) controls the highlighting.

A suggestion can also carry a full formattedAddress. If every suggestion does, you do not need the second target at all.

purchase.address-autocomplete.format-suggestion runs when the buyer picks a suggestion that you sent without an address. It receives shopify.target.selectedSuggestion (your id, label and matchedSubstrings) and must return a formattedAddress. This suits providers with a two-step flow, where the search call returns lightweight candidates and a second call retrieves the full record. A postal code lookup, which the reference lists as a use case, fits the same shape: the buyer types a postcode, picks a premises from the list, and only then do you fetch the full address.

What does the extension configuration need?

api_version = "2026-10"

[[extensions]]
name = "address-autocomplete"
handle = "address-autocomplete"
type = "ui_extension"

[[extensions.targeting]]
module = "./src/suggest.js"
target = "purchase.address-autocomplete.suggest"

[[extensions.targeting]]
module = "./src/format-suggestion.js"
target = "purchase.address-autocomplete.format-suggestion"

[extensions.capabilities]
network_access = true

shopify app generate extension adds the uid. Two access requests sit outside the file. The capabilities guide says network_access must be requested before you can publish; in the Dev Dashboard that is now Settings, Access requests, Enable network access, and the guide says it is approved automatically. The tutorial also requires a protected customer data access request, because the target input is the buyer’s address. The type definitions mark latitude, longitude and the address line components as needing level 2 access.

Your server has to answer with Access-Control-Allow-Origin: *, because extensions run in a Web Worker whose origin can change. Our checkout UI extension fetch guide covers CORS, session tokens and the 401s in detail.

How should the suggest target handle fast typing?

Keep the provider’s API key on your server. Anything bundled into the extension ships to every buyer’s browser. The extension calls your endpoint with a session token, and your endpoint calls the provider.

// extensions/address-autocomplete/src/suggest.js
import {toFormattedAddress} from './address.js';

const API = 'https://addresses.example.com/v1';

export default async function suggest() {
  const {field, value, selectedCountryCode, acceptedAddressInputFields} =
    shopify.target;

  const query = value.trim();
  if (query.length < 3 || !selectedCountryCode) return {suggestions: []};

  const params = new URLSearchParams({
    q: query,
    field,
    country: selectedCountryCode,
  });

  try {
    const token = await shopify.sessionToken.get();
    const response = await fetch(`${API}/suggest?${params}`, {
      headers: {Authorization: `Bearer ${token}`},
      signal: shopify.signal,
    });
    if (!response.ok) return {suggestions: []};

    const {results} = await response.json();
    return {
      suggestions: results.slice(0, 5).map((result) => ({
        id: result.id,
        label: result.label,
        matchedSubstrings: result.matches,
        formattedAddress: result.address
          ? toFormattedAddress(result.address, acceptedAddressInputFields)
          : undefined,
      })),
    };
  } catch {
    // An AbortError when the buyer keeps typing, or a network failure.
    return {suggestions: []};
  }
}

shopify.signal is the part to get right. Its type definition says it aborts when the buyer leaves the address field or when the debounced query value changes. Pass it to fetch and a slow response for “10 Down” cannot land after the buyer has typed “10 Downing St”. The catch block then turns the rejected fetch into an empty list instead of an unhandled rejection.

The three-character minimum and the empty list for a missing country are our own choices, not Shopify rules. They just save provider calls on input that cannot match anything useful. Returning {suggestions: []} on a failed request means the buyer types the address by hand, which is what they would do without autocomplete anyway.

Why does a components-only address blank the form?

Some countries collect the street name and house number in separate inputs. AutocompleteAddress supports this through addressLineComponents (streetName, streetNumber, additionalInformation, district, subdistrict and so on). The type definition carries a warning: “Always send the flat lines as well: a form without component inputs ignores the components, so a components-only suggestion clears both lines in that form.”

acceptedAddressInputFields tells you which inputs the current form has, but it is “undefined until the address format loads”, and Shopify does not validate your output against it. So the shared helper always sends address1 and address2, and only adds components the form accepts:

// extensions/address-autocomplete/src/address.js
/**
 * Turn our server's address into Shopify's AutocompleteAddress.
 * Flat lines always go back; components only for inputs this form accepts.
 */
export function toFormattedAddress(address, acceptedAddressInputFields) {
  const {components, ...flat} = address;
  if (!components || !acceptedAddressInputFields) return flat;

  const accepted = Object.fromEntries(
    Object.entries(components).filter(([key]) =>
      acceptedAddressInputFields.includes(key),
    ),
  );
  return Object.keys(accepted).length > 0
    ? {...flat, addressLineComponents: accepted}
    : flat;
}

Shopify’s own tutorial code follows the same rule. Our version also drops components entirely while the format is still loading, since there is nothing to check them against yet.

Why does format-suggestion need its own timeout?

The format-suggestion API has no signal. Its type exposes only target. Nothing cancels a slow lookup for you, so set your own timeout:

// extensions/address-autocomplete/src/format-suggestion.js
import {toFormattedAddress} from './address.js';

const API = 'https://addresses.example.com/v1';

export default async function formatSuggestion() {
  const {selectedSuggestion, acceptedAddressInputFields} = shopify.target;
  const {id} = selectedSuggestion;
  if (!id) throw new Error('Suggestion has no id to resolve');

  const token = await shopify.sessionToken.get();
  const response = await fetch(`${API}/address/${encodeURIComponent(id)}`, {
    headers: {Authorization: `Bearer ${token}`},
    signal: AbortSignal.timeout(3000),
  });
  if (!response.ok) throw new Error(`Address lookup failed: ${response.status}`);

  const {address} = await response.json();
  return {
    formattedAddress: toFormattedAddress(address, acceptedAddressInputFields),
  };
}

id is optional on AddressAutocompleteSuggestion, and TypeScript caught that when we type-checked this file against the package: encodeURIComponent(selectedSuggestion.id) does not compile under strict. The guard makes the failure explicit. Shopify’s reference examples throw on a failed lookup, and so does this one. The docs do not say what checkout shows the buyer when this target throws, so test that path in a dev store before you rely on it. Three seconds is our number; pick one that matches your provider’s latency.

How do you test it before a dev store?

Both modules are plain async functions that read a global, so node --test can drive them with a stubbed globalThis.shopify and fetch. Our tests cover the short-query early return, the five-suggestion cap, component filtering with and without acceptedAddressInputFields, an aborted signal resolving to an empty list, a 502 from the server, the missing-id guard and the timeout.

After that, run shopify app dev. Because these targets render nothing, you check them in the checkout and accounts editor: Settings, Address autocompletion, select your app, then type into the delivery address. If the CLI prints ShopifyCLI:AdminAPI requires the property token to be set, the tutorial’s fix is shopify app dev --checkout-cart-url cart/{variant_id}:{quantity}. For what the other checkout targets can and cannot do, see our checkout UI extensions overview.

What we would do

On a non-Plus store, there is nothing to build here, and the built-in autocomplete covers the UK. On Plus, we would build a custom provider only when a named country outside Shopify’s list is losing orders to bad addresses, or when a downstream system needs the same normalised address or coordinates that checkout collects. In that case we would return formattedAddress from suggest wherever the provider allows it, and use format-suggestion only for genuinely two-step lookups like postcode-to-premises.

Whoooop builds Shopify checkout extensions and the server code behind them, including the token verification and provider calls this post leaves to your endpoint. If your Plus store needs a custom address provider, our Shopify development page explains how we work.

Need this built properly?

Get in touch

Hack the planet!