This is a beta release of documentation for Magento 2.4, published for previewing soon-to-be-released functionality. Content in this version is subject to change. Links to the v2.4 code base may not properly resolve until the code is officially released.

currency query

Use the currency query to return information about the store’s currency configuration.

Syntax

{currency {Currency}}

Example usage

The following query returns the currency for the current instance of Magento:

Request:

1
2
3
4
5
6
7
8
9
10
11
12
13
query {
    currency {
        base_currency_code
        base_currency_symbol
        default_display_currency_code
        default_display_currency_symbol
        available_currency_codes
        exchange_rates {
            currency_to
            rate
        }
    }
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "data": {
    "currency": {
      "base_currency_code": "USD",
      "base_currency_symbol": "$",
      "default_display_currency_code": null,
      "default_display_currency_symbol": null,
      "available_currency_codes": [
        "USD"
      ],
      "exchange_rates": [
        {
          "currency_to": "USD",
          "rate": 1
        }
      ]
    }
  }
}

Output attributes

The currency object provides the following attributes:

Attribute Data type Description
available_currency_codes [String] An array of currencies accepted by the store
base_currency_code String The base currency set for the store, such as USD
base_currency_symbol String The symbol for the specified base currency, such as $
default_display_currency_code String Specifies if the currency code is set as the store’s default
default_display_currency_symbol String Specifies if the currency symbol is set as the store’s default
exchange_rates [ExchangeRate] An array of exchange rates specified in the store

Exchange rate attributes

The ExchangeRate object provides the following attributes:

Attribute Data type Description
currency_to String Specifies the store’s default currency to exchange to
rate Float The exchange rate for the store’s default currency