selectLocalesAndCurrenciesSettings$(): Observable<{ locales: TLocale[], currencies: TCurrency[] }>¶
The selectLocalesAndCurrenciesSettings$ method allows you to get an observable that emits all available locales and currencies in the shop
Returned value¶
A returned value has a type of Observable with an object containing two properties:
- locales - Array of TLocale objects representing all available locales
- currencies - Array of TCurrency objects representing all available currencies
Example¶
In this example we make a StorefrontSettingsApi call to get an observable with all available locales and currencies in the shop.
useStorefront(async (storefront) => {
const storefrontSettingsApi = storefront.getApiSync('StorefrontSettingsApi');
const localesAndCurrencies$ = storefrontSettingsApi.selectLocalesAndCurrenciesSettings$();
localesAndCurrencies$.subscribe((localesAndCurrencies) => {
console.log('Available locales:', localesAndCurrencies.locales);
console.log('Available currencies:', localesAndCurrencies.currencies);
});
});
Storefront Settings API methods reference¶
- getSkinSettings
- getPageSettings
- selectSkinSettings$
- selectPageSettings$
- selectFrontstoreApiUrl$
- getLocales
- selectLocales$
- getLocalesAndCurrenciesSettings
- getAllLocales
- selectAllLocales$
- getCurrencies
- selectCurrencies$
- getCountries
- selectCountries$
- getCountryById
- selectCountryById$
- getCountryByCode
- selectCountryByCode$