format_price Filter
Format a price in subunits to a formatted string based off the curent locale. If no currency
is provided, defaults to USD
.
{% set formattedPrice = item.price.high.amount|format_price({ currency: item.price.high.currency }) %}
{{ formattedPrice }}
{# $5.00 #}
You may also supply the optional min_fraction_digits
option.
{% set formattedPrice = item.price.high.amount|format_price({ currency: item.price.high.currency, min_fraction_digits: 0 }) %}
{{ formattedPrice }}
{# $5 #}
The filter can take in a localization source
property.
{{ item.price.high.amount|format_price({}, 'SITE') }}