Money with currency

From Shopify Wiki

Jump to: navigation, search

money_with_currency(money)

This filter takes a number and wraps the right currency symbol/descriptor around it.

Example:

{{ variant.price | money_with_currency }}

variant.price is this variant's price without a currency symbol or descriptor (so just the plain number). By sending it through the filter money_with_currency it adds the shop's currency to it. If the variant's price were let's say "27.00" and the store's currency was USD, the result of the above code would be "$27.00 USD".

Also note, that because this filter uses another filter money internally, it will then have a span tag with the class "currency" wrapped around the $(dollar) symbol. So you can style this in whatever way you like to.

Personal tools