How to return a currency object in liquid

Topic summary

Goal: retrieve the currency symbol in Shopify Liquid when shop.currency returns only the ISO code (e.g., “USD”). Direct access via shop.currency.symbol does not work as expected.

Working approaches:

  • Parse shop.money_format to extract the symbol. Implemented both in JavaScript (substring from money_format) and in Liquid (capture shop.money_format, split at “{”, take the first segment).
  • Use cart.currency.symbol when a cart object is present.
  • Loop through shop.enabled_currencies and output currency.symbol for the one whose iso_code matches shop.currency (the store’s primary currency). This runs once if only one currency is enabled.

Caveats and limitations:

  • Symbols may differ from expectations by locale/Shopify data. Example: Egyptian Pound (EGP) can return “ج.م” instead of “LE”.
  • cart.currency.symbol depends on cart context and may not be suitable outside cart pages.
  • The documented Currency object appears inaccessible directly via shop.currency, prompting workarounds.

Status: No official fix confirmed. Community relies on Liquid/JS parsing or enabled_currencies iteration. Code snippets are central to the solutions. Unresolved edge cases remain for certain currencies/symbol variants.

Summarized with AI on December 23. AI used: gpt-5.

I can see in the Liquid reference that there is a “Currency” object with a “Symbol” attribute

The example shows that this code:

Symbol: {{ currency.symbol }}

should produce this output:

Symbol: $ 

How can I retrieve the symbol property of “shop.currency” ?

I tried shop.currency.symbol with no luck.

How can I use the symbol attribute on the shop currency if it return the ISO value as a string?

2 Likes

Hi @Giulio1

It’s pretty disappointing that the currency object is inaccessible even though it is stated in the docs.

I was able to get this to work by accessing shop.money_format and then i used substring to extract the currency symbol from the result.

It’s a bit of an hack but i guess it works (:

Here is my code:

let shop_symbol = "{{ shop.money_format }}";
  shop_symbol = shop_symbol.trim();
  if (shop_symbol.substring(shop_symbol.length - 1) !== '}' && shop_symbol.substring(shop_symbol.length - 1).length > 0) {
  	shop_symbol = shop_symbol.substring(shop_symbol.length - 1);
  } else {
    shop_symbol = shop_symbol.substring(0, 1);
  }

Alternatively, which is way better, you can create a function that just replaces the variables, with your product price. You can find all the possible currency variables in here: https://help.shopify.com/en/manual/payments/currency-formatting

1 Like

Thank you for this solution, @mr-easy . It’s a good work-around.

Here’s my version, in Liquid:

{% capture currencyString %}{{ shop.money_format }}{% endcapture %}
{% assign tempArray = currencyString | split: ‘{’ %}
{% assign currencySymbol = tempArray.first %}

{{ currencySymbol }}

I’ve only tested it for one currency, however, as that’s all my shop is set up to serve.

You can do this a couple different ways in liquid. The simplest is:

{{ cart.currency.symbol }}

You can also do this. It will only run once if you only have one currency enabled.

{% for currency in shop.enabled_currencies %}
  {{ currency.symbol }}
{% endfor %}

If you have more than one and you’re just looking for the shop’s primary/default currency, you can add a quick check like this:

{% for currency in shop.enabled_currencies %}
  {% if currency.iso_code == shop.currency %}
    {{ currency.symbol }}
    {% break %}
  {% endif %}
{% endfor %}
7 Likes

Thanks, Gina. That’s a much better solution than mine.

This is returning the wrong symbol for some countries.

Egyptian pound (EGP) will return “ج.م” instead of “LE”

{{ cart.currency.symbol }}