CorvidReference

SiteSettings

Site-related currency settings.

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.

Table of Contents

FUNCTIONS

?
Perform actions on an object.
getCurrencies( )Gets the list of supported currencies that you set for your site.
setCurrencies( )Sets the list of currencies that the site will support.

OBJECTS

?
Objects used when setting, getting, or calling the properties and methods listed above.
CurrencyCodeAn object representing an ISO currency code.

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 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(): Promise<Array<CurrencyCode>>
RETURN VALUE
?
Value that a function evaluates to when it is finished running.
Promise<Array<CurrencyCode>>
Fulfilled - The list of all currencies set for this site.

Examples

Get currencies that were set for this site.

import {currencies} from 'wix-pay-backend';

currencies.siteSettings.getCurrencies()
  .then((siteCurrencies) => {
    const firstSiteCurrencyCode = siteCurrencies[0].code;
  });

/*
 *  siteCurrencies:
 *  [
 *    {"code": "USD"},
 *    {"code": "BRL"},
 *    {"code": "JPY"}
 *  ]
 */

setCurrencies( )

Sets the list of currencies that the site will support.

Description

The setCurrencies() function sets the list of currencies that you want your site to support. This is a subset of the list of currencies supported by Wix as returned by getAllCurrencies(). The currencies set will be displayed in the currency conversion dropdown element. Selecting a currency from the dropdown on a store page will display the prices in the selected currency.

Note

For SiteSettings functions to work, your site must contain a Wix Stores page including the currency conversion element.

The currency codes used must exist in the array returned by the getAllCurrencies() function.

Syntax

function setCurrencies(options: Array<CurrencyCode>): Promise<void>
PARAMETERS
?
Values that you pass to a function.
options
Currencies to be supported by the site.
RETURN VALUE
?
Value that a function evaluates to when it is finished running.
Promise<void>

Examples

Set the currencies to be supported by this site.

import {currencies} from 'wix-pay-backend';

currencies.siteSettings.setCurrencies(
  [
    {"code": "USD"}, 
    {"code": "BRL"}, 
    {"code": "JPY"}
  ]
)
  .then(console.log("currencies set")
  );

CurrencyCode

An object representing an ISO currency code.

Syntax

type CurrencyCode = {
  code: string
}
MEMBERS
?
The properties of an object.
code
string

A 3-letter ISO-4217 currency code.