Money filters
| Attribute | Return type | Description |
|---|---|---|
| money | string or null | Formats number to currency format. |
| money_with_fraction_digits | string or null | Formats number to currency format. |
| money_and_tax | string or null | Formats number to currency format. |
| money_without_currency | string or null | Formats number to currency format. |
money
Formats number to currency format.
It also rounds the price with precission according to the global currency setting.
{{ 1234.56 | money }}
{# $ 1 234,56 if precission is set to "hundreths" #}
{# $ 1 234 if precission is set to "integers" #}
Optionally, you can provide an argument with currency (string
with currency ISO code or currency object). If no argument
provided, the current_currency object is used.
{{ 1234.56 | money('EUR') }}
{{ 1234.56 | money(order.currency) }}
{# € 1 234,56 #}
{# € 1 234,56 if order.currency is a currency object #}
If a price object is used as a value instead of number,
money filter outputs price with or without TAX based on TAX global
settings.
{{ product.price | money }}
{# $ 1 234,56 #}
money_with_fraction_digits
Formats number to currency format.
It's done in the same way as money filter, but adds trailing
zeroes if price is integer.
{{ 1234 | money_with_fraction_digits }}
{# $ 1 234,00 #}
{{ 1234 | money_with_fraction_digits('EUR') }}
{# € 1 234,00 #}
{{ product.price | money_with_fraction_digits }}
{# $ 1 234,00 #}
money_and_tax
Formats number to currency format.
It's done in the same way as money filter and adds information,
if price is with or without TAX based on TAX global settings.
{{ 1234.56 | money_and_tax }}
{# $ 1 234,56 incl. TAX #}
{{ 1234.56 | money_and_tax('EUR') }}
{# € 1 234,56 incl. TAX #}
{{ product.price | money_and_tax }}
{# $ 1 234,56 incl. TAX #}
money_without_currency
Formats number to currency format.
It's done in the same way as money filter except of adding
currency symbol.
{{ 1234.56 | money_without_currency }}
{# 1 234,56 #}
{{ 1234.56 | money_without_currency('EUR') }}
{# 1 234,56 #}
{{ product.price | money_without_currency }}
{# 1 234,56 #}