Headless API
SDK reference
hydrogen
lib
money

lib/money

Interfaces

JoyMoney

The /shop-config subset every money-printing block needs.

Properties

currency
currency: string;
currencyFormat
currencyFormat: string;

Functions

formatMoney()

function formatMoney(value, money): string;

Render an amount with the shop's Shopify money format.

currencyFormat may carry markup (<span class=money>${{amount}}</span>) — strip it, since this goes into a text node. Whole amounts drop the decimals: "$10 off" reads better than "$10.00 off", and loyalty amounts are almost always round.

Parameters

ParameterType
valuenumber
moneyJoyMoney

Returns

string


formatOrderMoney()

function formatOrderMoney(
   value, 
   money, 
   locale?
): string;

Receipt-grade money for the orders surface — ALWAYS 2 fraction digits plus locale thousands grouping (123456 cents → $1,234.56, 5000 → $50.00), matching the core order path (formatShopifyPrice → displayMoneyValue({minimumFractionDigits: 2})). An order receipt must show cents and grouping; the loyalty-label formatMoney deliberately drops decimals on round amounts and adds no grouping, so this is a separate export scoped to orders — do NOT swap it into the loyalty callers.

Keeps the shop's Shopify money format (currency symbol/placement); only the number's own formatting changes. value is a decimal amount (already divided out of cents), matching formatMoney.

Parameters

ParameterType
valuenumber
moneyJoyMoney
locale?string

Returns

string