Lists the site's active markets: the groups of countries the merchant sells into, each
with its languages and currency. Accessible via lynkow.markets, for a country picker
at checkout or a market switcher.
Requires a publishable key: pass publishableKey to createClient(), or every call
throws LynkowError UNAUTHORIZED. With cache: true, responses are cached for 5
minutes.
Access via: lynkow.markets
Methods
1 method
list
list(options?: BaseRequestOptions): Promise<MarketList>Lists every active market of the site, oldest first, without pagination. A draft
market is never listed. meta.checkoutCountries holds the delivery countries
checkout accepts. The list does not depend on the locale. Throws LynkowError
NOT_FOUND when commerce or markets are off for the site.
Parameter | Type | Description |
|---|---|---|
|
| Optional |
Returns: Promise<MarketList>
const { data: markets } = await lynkow.markets.list()
// The market a buyer's country belongs to, if any.
const market = markets.find((m) => m.countries.includes('BE'))
if (market) {
console.log(market.name, market.currency, market.defaultLocale)
} else {
// The site does not deliver to that country.
}