Settings
Settings methods can be used to retrieve configuration data from the Middleware or SDK.
Coverage
The following table provides an overview of the methods and their coverage across different platforms.
Method | Commercetools | SAPCC | BigCommerce | SFCC | Magento |
---|---|---|---|---|---|
getCurrencies | ✅ | ✅ | ✅ | ✅ | ✅ |
getCurrencies
The getCurrencies
method retrieves currencies data set in SDK configuration.
Usage
const currencies = await sdk.unified.getCurrencies();
Configuration
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",
},
});
Type
export type getCurrencies = () => Promise<{
currencies: SfCurrency[];
defaultCurrency: SfCurrency;
}>;
export type SfCurrency = string;