You can get and set the currencies that you want to support on your site. These are the currencies that are displayed in the currency conversion element and used to convert currencies in your Wix Store.
The currency codes used must exist in the array returned by the getAllCurrencies()
function.
Note: For SiteSettings functions to work, your site must contain a Wix Stores page including the currency conversion element.
Gets the list of supported currencies that you set for your site.
The getCurrencies()
function returns a Promise that resolves to an array of currencies that were set for use in the site using siteSetting.setCurrencies()
.
This function is different from the getAllCurrencies()
function in that it gets only the currencies that have
been set for use in this site using the siteSetting.setCurrencies()
function.
The getAllCurrencies()
function gets the complete list of all of the currencies that can be supported.
Note: For SiteSettings functions to work, your site must contain a Wix Stores page including the currency conversion element.
function getCurrencies(): Promise<Array<CurrencyCode>>;
import { currencies } from "wix-pay-backend";
currencies.siteSettings.getCurrencies().then((siteCurrencies) => {
const firstSiteCurrencyCode = siteCurrencies[0].code;
});
/*
* siteCurrencies:
* [
* {"code": "USD"},
* {"code": "BRL"},
* {"code": "JPY"}
* ]
*/