Skip to main content

Countries Module

The countries module manages supported countries for shipping, billing, and localization.

Configuration Options

The countries module has no configuration options.

Module API

Access via modules.countries in the Unchained API context.

Queries

MethodArgumentsDescription
findCountry{ countryId? | isoCode? }Find country by ID or ISO code
findCountries{ limit?, offset?, sort?, ...query }List countries with pagination
countqueryCount countries matching criteria
countryExists{ countryId }Check if country exists
namecountry, localeGet localized country name
flagEmojicountryGet country flag emoji
isBasecountryCheck if this is the default country

Mutations

MethodArgumentsDescription
createdocCreate a new country
updatecountryId, docUpdate country
deletecountryIdDelete country

Usage

// Find a country by ISO code
const country = await modules.countries.findCountry({ isoCode: 'CH' });

// Get localized name
const name = modules.countries.name(country, 'en'); // "Switzerland"

// Get flag emoji
const flag = modules.countries.flagEmoji(country); // "🇨🇭"

// List all active countries
const countries = await modules.countries.findCountries({
includeInactive: false,
});

Events

EventPayloadDescription
COUNTRY_CREATE{ countryId }Emitted when a country is created
COUNTRY_UPDATE{ countryId }Emitted when a country is updated
COUNTRY_REMOVE{ countryId }Emitted when a country is removed