Search.../

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:

Promise<Array<CurrencyCode>>
NAME
TYPE
DESCRIPTION
code
string

A 3-letter ISO-4217 currency code.

Was this helpful?

Get currencies that were set for this site.

Copy Code
1/*****************
2 * back end code *
3 *****************/
4
5import { Permissions, webMethod } from 'wix-web-module';
6import { currencies } from 'wix-pay-backend';
7
8export const setSiteCurrencies = webMethod(Permissions.Anyone, () => {
9 currencies.siteSettings.setCurrencies(
10 [
11 {"code": "USD"},
12 {"code": "BRL"},
13 {"code": "JPY"}
14 ]
15 );
16});
17
18/*******************
19 * front end code *
20 *******************/
21
22import { currencies } from 'wix-pay-frontend';
23import { setSiteCurrencies } from 'backend/myModule.web';
24
25setSiteCurrencies()
26 .then((results ) => {
27 currencies.siteSettings.getCurrencies()
28 .then((listOfSiteCurrencies) => {
29 const firstCurrencyCode = listOfSiteCurrencies[0].code;
30 });
31 });
32
33/*
34 * listOfSiteCurrencies:
35 * [
36 * {"code": "USD"},
37 * {"code": "BRL"},
38 * {"code": "JPY"}
39 * ]
40 */