use-shopping-cart logouse-shopping-cart
Helpers

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"
}

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'

Shopping Cart

Your cart is empty

Try the interactive demos on the docs pages!