getCountries(): Country[]¶
The getCountries
method allows you to retrieve the countries currently supported in a shop.
Returned value¶
A returned value has a type of Country[]
where Country
represents the Country model.
Example¶
In this example we make a StorefrontSettingsApi
call to retrieve the countries currently supported in a shop.
useStorefront(async (storefront) => {
const storefrontSettingsApi = storefront.getApiSync('StorefrontSettingsApi');
const countries = storefrontSettingsApi.getCountries();
countries.forEach((country) => {
console.log('name of the country:', country.name);
})
});
Storefront Settings API methods reference¶
- getSkinSettings
- getPageSettings
- selectSkinSettings$
- selectPageSettings$
- selectFrontstoreApiUrl$
- getLocales
- selectLocales$
- selectCountries$
- getCountryById
- selectCountryById$
- getCountryByCode
- selectCountryByCode$