AddressConfig

interface AddressConfig { defaultCountry?: string; showCountries?: string[]; dontShowStates?: string[]; countries?: { code: string; name: string }[]; enableAutocomplete?: boolean; }

Source: global.ts:1296

Settings for the checkout's country and state dropdowns and its address suggestions. All are optional. The campaign's shipping countries decide the country list, so the country settings here only apply to a campaign that has none set.

Example

CODE
window.nextConfig = {
  addressConfig: {
    dontShowStates: ['AK', 'HI'],
    enableAutocomplete: true,
  },
};

Properties

defaultCountry: string

Read only when the country list is empty, so it cannot choose which country the form opens on. With a country list, the form opens on the shopper's detected country when the campaign ships there, otherwise the United States, otherwise the first country in the list.

Example

CODE
"US"

showCountries: string[]

deprecated
global.ts:1312

Set the shipping countries on the campaign instead. This list is read only when the campaign has no shipping countries and countries is not set.

Example

CODE
["US", "CA", "GB"]

dontShowStates: string[]

State or province codes to leave out of the state dropdown. US territories (AS, GU, MP, PR, VI and the UM minor outlying islands) are always left out and cannot be brought back.

Example

CODE
["AK", "HI"]

countries: { code: string; name: string }[]

A country list with your own names. Read only when the campaign has no shipping countries set: the campaign's list always wins.

Example

CODE
[{ code: "US", name: "United States" }]

enableAutocomplete: boolean

true turns on NextCommerce address suggestions on the street address field. A Google Maps key in window.nextConfig.googleMaps.apiKey takes priority over it.