Skip to content

selectCurrencies$(): Observable

The selectCurrencies$ method allows you to get an observable that emits all available currencies in the shop

Returned value

A returned value has a type of Observable that emits an array of TCurrency objects representing all available currencies in the shop.

Example

In this example we make a StorefrontSettingsApi call to get an observable with all available currencies in the shop.

    useStorefront(async (storefront) => {
        const storefrontSettingsApi = storefront.getApiSync('StorefrontSettingsApi');

        const currencies$ = storefrontSettingsApi.selectCurrencies$();

        currencies$.subscribe((currencies) => {
            currencies.forEach((currency) => {
                console.log('Currency:', currency.name, 'Code:', currency.code, 'Symbol:', currency.symbol);
            });
        });
    });

Storefront Settings API methods reference