forked from crowetic/commerce
Add totals to cart
This commit is contained in:
@@ -1,19 +1,4 @@
|
||||
function formatPrice({
|
||||
amount,
|
||||
currencyCode,
|
||||
locale,
|
||||
}: {
|
||||
amount: number
|
||||
currencyCode: string
|
||||
locale: string
|
||||
}) {
|
||||
const formatCurrency = new Intl.NumberFormat(locale, {
|
||||
style: 'currency',
|
||||
currency: currencyCode,
|
||||
})
|
||||
|
||||
return formatCurrency.format(amount)
|
||||
}
|
||||
import formatPrice from './format-price'
|
||||
|
||||
export default function formatVariantPrice({
|
||||
listPrice,
|
||||
|
16
utils/format-price.ts
Normal file
16
utils/format-price.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export default function formatPrice({
|
||||
amount,
|
||||
currencyCode,
|
||||
locale,
|
||||
}: {
|
||||
amount: number
|
||||
currencyCode: string
|
||||
locale: string
|
||||
}) {
|
||||
const formatCurrency = new Intl.NumberFormat(locale, {
|
||||
style: 'currency',
|
||||
currency: currencyCode,
|
||||
})
|
||||
|
||||
return formatCurrency.format(amount)
|
||||
}
|
Reference in New Issue
Block a user