Vue Storefront is now Alokai! Learn More
Settings

Settings

Settings methods can be used to retrieve configuration data from the Middleware or SDK.

Coverageri:link

The following table provides an overview of the methods and their coverage across different platforms.

MethodCommercetoolsSAPCCBigCommerceSFCCMagento
getCurrencies

getCurrenciesri:link

The getCurrencies method retrieves currencies data set in SDK configuration.

Usageri:link

const currencies = await sdk.unified.getCurrencies();

Configurationri:link

You can set the valid currencies and a default currency in your middleware.config.ts file. Learn more about currency switching.

export const unifiedApiExtension = createUnifiedExtension<Context>()({
  normalizers,
  apiMethods: {
    ...methods<typeof normalizers>(),
  },
  config: {
    currencies: ["USD", "EUR"],
    defaultCurrency: "USD",
  },
});

Typeri:link

export type getCurrencies = () => Promise<{
  currencies: SfCurrency[];
  defaultCurrency: SfCurrency;
}>;

export type SfCurrency = string;