getCurrencies( )
Gets the list of supported currencies that you set for your site.
Description
The getCurrencies()
function returns a Promise that resolves to an array of currencies that were set for use in the site using the backend function 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.
Syntax
function getCurrencies(): CurrencyCode
getCurrencies Parameters
This function does not take any parameters.
Returns
Fulfilled - The list of all currencies set for this site.
Return Type:
NAME
TYPE
DESCRIPTION
Was this helpful?
Get currencies that were set for this site.
1/*****************2 * back end code *3 *****************/45import { Permissions, webMethod } from 'wix-web-module';6import { currencies } from 'wix-pay-backend';78export const setSiteCurrencies = webMethod(Permissions.Anyone, () => {9 currencies.siteSettings.setCurrencies(10 [11 {"code": "USD"},12 {"code": "BRL"},13 {"code": "JPY"}14 ]15 );16});1718/*******************19 * front end code *20 *******************/2122import { currencies } from 'wix-pay-frontend';23import { setSiteCurrencies } from 'backend/myModule.web';2425setSiteCurrencies()26 .then((results ) => {27 currencies.siteSettings.getCurrencies()28 .then((listOfSiteCurrencies) => {29 const firstCurrencyCode = listOfSiteCurrencies[0].code;30 });31 });3233/*34 * listOfSiteCurrencies:35 * [36 * {"code": "USD"},37 * {"code": "BRL"},38 * {"code": "JPY"}39 * ]40 */