Home > Shopify Development > How to use money filter

How to use money filter in Shopify

Sam Nguyen
Sam Updated: July 19, 2024

Share:

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

If you’re looking for a simple way to set up currency exchange for foreign buyers in your Shopify store, using money filters in Liquid can be a great solution. Many store owners struggle to display prices in different currencies for international customers. In this post, we’ll guide you on how to effectively install currency exchange by applying money filters in Shopify’s Liquid code.

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

Using money filters in Shopify Liquid allows you to easily display prices in different formats for international customers, making currency exchange simple and efficient. By applying the money filter, you can provide a seamless shopping experience for foreign buyers. With the right setup, you’ll confidently manage currency formats without hassle!


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.