Przejdź do głównej zawartości

Function: useFormatPrice()

useFormatPrice(): (price, localeOverride?) => string

Memoised formatPrice bound to the active language from <StorefrontProvider>. Pass localeOverride as the second argument to override the store value for a single call.

Returns

(price, localeOverride?) => string

Examples

const formatPrice = useFormatPrice();
return <span>{formatPrice(item.price)}</span>;
// Per-call override:
const formatPrice = useFormatPrice();
<span>{formatPrice(item.price, 'en-US')}</span>