Home > Shopify Development > How to use money filter

How to use money filte in Shopify

Sam Nguyen
Sam Updated: July 19, 2024

Share:

Drive 20-40% of your revenue with Avada
avada email marketing

Would you want to install currency exchange for foreign buyers? Then your questions will be answered by money filters in Liquid. Since 2006, Liquid has become one of the most popular template languages in Shopify. Thanks to Liquid backbone, you can use tags or filters in order to upload complex content on your front page. This tutorial today focuses on money filter.

Table of content

Introduction to Liquid

As you know, Liquid is one of the open-source template languages in Shopify. Liquid is used as the backbone of Shopify to upload dynamic content on the front page. Liquid has been sold since 2006 and now become a good source for a lot of hosted website application namely Jekyll, salesforce desk, and zendesk.

What is money filter

Money filter in Liquid assists you in calculating the customers’ bills with a different currency from yours. The function is useful for websites that sell goods for both domestic and foreign customers. Money filter format is built based on the Currency Formatting found in General Settings.

By clicking on standards and formats, you can change the currency to inform purchasers about their payments.

This tutorial will guide you to use money filter, money with currency, money without trailing zeros, money without currency.

How to use money filter

First, money calculate the prices based on the shop’s HTML without currency setting.

Input


{{ 145 | money }}

Output


<!-- if "HTML without currency" is ${{ amount }} -->
$1.45
<!-- if "HTML without currency" is €{{ amount_no_decimals }} -->
€1

Second, money_with_currency formats the price based on the shop’s HTML with currency setting.

Input


{{ 145 | money_with_currency }}

Output


<!-- if "HTML with currency" is ${{ amount }} CAD -->
$1.45 CAD

Third, you can access money without trailing zeros by opening the shop’s HTML with currency setting and excluding the decimal point and trailing zeros.

Input


<!-- if "HTML with currency" is ${{ amount }} CAD -->
{{ 2000 | money_without_trailing_zeros }}

Output


$20

In case you want to remove trailing zeros, not other digits, you can follow.

Input


<!-- if "HTML with currency" is ${{ amount }} CAD -->
{{ 145 | money_without_trailing_zeros }}

Output


$1.45

Finally, money_without_currency calculates the price using a decimal.

Input


{{ 145 | money_without_currency }}

Output


1.45

Conclusion

In conclusion, money filter is an essential tool for online shops selling products for foreign customers. Money filter helps you to estimate the exact price based on the currency of buyers’ countries. We hope that your problems are addressed and let us know your difficulties so that we can help you.


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.

Stay in the know

Get special offers on the latest news from AVADA.