use-shopping-cart

formatCurrencyString()

formatCurrencyString formats the prices of the products. It takes an object shaped like this:

NameType
valuenumber
currencystring
language (optional)string
{
value: 400,
currency: 'USD',
language: 'EN' //optional
}

If you don't pass a value to language, it will choose language based on the browsers settings

import { formatCurrencyString } from 'use-shopping-cart/src/util'
formatCurrencyString({ value, currency })
// returns $4.00
Edit this page on GitHub