Twig Filters

|commerceCurrency #

You can use the |commerceCurrency filter as a drop-in replacement for the built in Craft |currency filter. But in addition to currency formatting, it can also be used for currency conversion, by setting the convert param to true. In addition to that, the currency formatting can also be disabled by setting the format param to false, if you just want to get the raw converted currency value as a float.

currency (string) #

A valid payment currency

convert (bool) default: false #

Should the amount passed to this filter be converted to the exchange rate of the payment currency iso passed

format (bool) default: true #

Should the amount passed to this filter be converted to the exchange rate of the payment currency iso passed

stripZeros (bool) default: false #

Should the amount passed have it’s minor units zeros removed for a cleaner looking number.

Examples: #

{{ 10.00|commerceCurrency(cart.currency) }} // US$ 10.00

{{ order.totalPrice|commerceCurrency(cart.paymentCurrency,convert=true) }} // A$ 13.00

{{ order.totalPrice|commerceCurrency('AUD',convert=true,format=false) }} // 13.0000

{{ order.totalPrice|commerceCurrency('AUD',convert=true,format=true) }} // A$ 13.00

{{ order.totalPrice|commerceCurrency('AUD',convert=true,format=true,stripZeros=true) }} // A$ 13

You might want to show the order’s price in all available payment currencies:

{% for currency in craft.commerce.paymentCurrenciess %}
    Total in {{ currency.iso|upper }}: {{ cart.totalPrice|commerceCurrency(cart.paymentCurrency,convert=true) }} <br>
{% endfor %}
</select>

Buy Craft Commerce

Craft Commerce site license

Includes

  • Standard tech support
  • Unlimited app updates
  • Craft Pro site license
Buy now for $999
Can I try before buying?

Absolutely. Just download it from the “Download” button in the site header and follow our installation instructions. You’ll have the full feature set to experiment with, with just one limitation: you won’t be able to charge credit cards. Until Craft Commerce has been purchased and activated, it’s limited to a single dummy gateway.

Will there be recurring/upgrade fees?

Nope, it’s just a one-time license fee per site.

Can I use this on an existing Craft site?

Yes! And if you already have a Craft Pro license (or you don’t need one), just flip that “Include a Craft Pro license” switch in the purchase form, and we’ll drop the price to $700.

Is Craft Pro required?

Craft Commerce does not require Craft Pro; it works perfectly fine on Craft Client and Personal editions as well!

Can I try before buying?

Absolutely. Just download it from the “Download” button in the site header and follow our installation instructions. You’ll have the full feature set to experiment with, with just one limitation: you won’t be able to charge credit cards. Until Craft Commerce has been purchased and activated, it’s limited to a single dummy gateway.

Will there be recurring/upgrade fees?

Nope, it’s just a one-time license fee per site.

Can I use this on an existing Craft site?

Yes! And if you already have a Craft Pro license (or you don’t need one), just flip that “Include a Craft Pro license” switch in the purchase form, and we’ll drop the price to $700.

Is Craft Pro required?

Craft Commerce does not require Craft Pro; it works perfectly fine on Craft Client and Personal editions as well!