Helpers
formatCurrencyString()
formatCurrencyString formats the prices of the products. It takes an object shaped like this:
| Name | Type |
|---|---|
| value | number |
| currency | string |
| language (optional) | string |
{
"value": 400,
"currency": "USD",
"language": "EN"
}If you don't pass a value to language, it will choose language based on the browsers settings
import { formatCurrencyString } from 'use-shopping-cart' // or
import { formatCurrencyString } from 'use-shopping-cart/core'
formatCurrencyString({ value: 400, currency: 'USD' })
// returns '$4.00'