Skip to main content

Overview

The createFormatter() function returns an Intl.NumberFormat instance configured for your store’s currency. Use it to display prices consistently throughout your storefront.

Getting the Formatter

Returns a standard JavaScript Intl.NumberFormat object configured with your store’s currency code (e.g., USD, EUR, GBP).

Basic Usage

Examples

Display Product Prices

Price Ranges

Display “From $X” for products with multiple variants:

Cart Total

Calculate and format basket totals:

Caching the Formatter

Create the formatter once and reuse it to avoid unnecessary API calls:

Intl.NumberFormat Methods

Since createFormatter() returns a standard Intl.NumberFormat, you have access to all its methods:

format()

Returns a formatted string:

formatToParts()

Returns an array of parts for custom rendering:

Currency by Store

The formatter automatically uses your store’s configured currency:

Complete Example

Next Steps

Store Information

Learn about other store data you can fetch

Basket Management

Manage shopping cart items
Last modified on November 27, 2025