Handlebars Helper Function: formatCurrency

The formatCurrency helper function formats a number as a currency value.

This function is a convenience function that calls formatNumber with the currency format type. It throws an error if the input can't be converted to a number.

Availability

This helper is available in the Winter ’26 release of Marketing Cloud Next.

Syntax

{{formatCurrency number cultureCode}}

Parameters

Parameter Type Description
number Number or String Required. The number to format as a currency value. If the value is a string, it must be convertible to a number.
cultureCode String A POSIX locale code for currency formatting, such as en_US or zh-TW. The operation supports both hyphen (fr-CA) and underscore (fr_CA) formats. If you don’t specify a culture code, the operation uses en_US.

Return Value

The operation returns a formatted string representation of the number as a currency value, using the specified locale’s currency format. Different locales use different currency symbols, decimal separators, and grouping patterns. For example, {{formatCurrency 1234.56 "en-US"}} returns $1,234.56, while {{formatCurrency 1234.56 "de-DE"}} returns 1.234,56 €. Different locales handle the rounding of currency values in different ways. For example, Japanese Yen is usually expressed without decimal places, so {{formatCurrency 1234.56 "ja-JP"}} returns ¥1,235.

If the input can’t be converted to a number, the operation throws an exception. This behavior helps you handle conversion errors gracefully by using the fallback helper, as shown in this example.

{{fallback (formatCurrency orderTotal) "Amount not available"}}

In this example, if orderTotal can’t be converted to a number, the operation returns Amount not available.

See Also