Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We are working on a feature where we want to add support for multi-currency so customers can pay through their local currency.
To achieve the functionality, we have a requirement to retrieve currency conversion rate within liquid. We did a lot of R&D and tried possible solutions, however, couldn't succeed.
We found that the rate can be obtained through a piece of JS code: window.Shopify.currency.rate, but this works on the storefront. If we use this way, it will add huge complexity to our code and execution.
How can we obtain currency conversion rate through liquid?
Did you find a solution for this? Has anything changed?
Hi Rose,
You can update the daily currency rate in metafields via say a script. Then, use Liquid to show these rates and calculate prices.
For instance, the liquid code could look like:
{% assign conversion_rate = shop.metafields.global.usd_to_gbp.value | default: 1.38 %}
{% assign product_price_gbp = product.price | times: conversion_rate %}
{{ product_price_gbp | money_with_currency }}
Let me know if you need any help!
Where can I find currency rate?
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025