MoneyV2
This page was printed on Feb 19, 2019. For the current version, visit https://help.shopify.com/en/api/custom-storefronts/storefront-api/reference/object/moneyv2.
A monetary value with currency.
To format currencies, combine this type's amount and currencyCode fields with your client's locale.
For example, in JavaScript you could use Intl.NumberFormat:
new Intl.NumberFormat(locale, {
style: 'currency',
currency: currencyCode
}).format(amount);
Other formatting libraries include:
- iOS - NumberFormatter
- Android - NumberFormat
- PHP - NumberFormatter
For a more general solution, the [Unicode CLDR number formatting database] is available with many implementations (such as TwitterCldr).
# A monetary value with currency.To format currencies, combine this type's amount and currencyCode fields with your client's locale.
For example, in JavaScript you could use Intl.NumberFormat:
```js
new Intl.NumberFormat(locale, {
style: 'currency',
currency: currencyCode
}).format(amount);
```
Other formatting libraries include:
* iOS - NumberFormatter
* Android - NumberFormat
* PHP - NumberFormatter
For a more general solution, the [Unicode CLDR number formatting database] is available with many implementations
(such as TwitterCldr).
type MoneyV2 { # Decimal money amount. amount: Decimal!
# Currency of the money. currencyCode: CurrencyCode! }
Fields