Is there a way to output the currency symbols for each accepted payment currency in a Craft Commerce site?

Consider the following simplified example;

{% set currencies = craft.commerce.paymentCurrencies %}
{% if currencies|length > 1 %}
<select name="paymentCurrency">
    {% for currency in currencies %}
        <option>{{ currency.iso }}</option>
    {% endfor %}
{% endif %}

Instead of the currency ISO code being output in the option, I also want to show the symbol. I can't find a method for doing so.

2 Answers 2


You don't need to create your own symbol map - it exists as a yii translation:

{% set localeData = craft.i18n.getLocaleData() %}
{% set currencyIso = 'USD' %}

{{ localeData.getCurrencySymbol(currencyIso)  }}
  • Wish I'd known this on a previous project! Upvoted!
    – Jason Mayo
    Jul 6, 2017 at 12:40
  • 1
    @JasonMayo I try to learn Craft by answering questions here. This one was easy: I searched for the '€' symbol in the code base and researched how to access the translation data. I'm glad it was helpful. Jul 10, 2017 at 9:08

I couldn't find a way to do this (So hopefully someone can come back on this, or it will be part of Commerce in future!)

But what I did was to create an array matching the ISO's to the symbol then checked the array if the symbol existed. Luckily we only offered a few currencies so it wasn't so much of a pain.

  • Simple mapping arrays are a nice way to customise an output. I usually setup a config/businesslogic.php configuration file to keep things organised. Then in the template (this is good use case for a Twig macro) I can get the data: {% set map = craft.config.get('currencyMap', 'businesslogic') %}.
    – carlcs
    Jul 5, 2017 at 12:27
  • @carlcs That's a great idea, might do that in future. Always had issues using custom variables etc across templates
    – Jason Mayo
    Jul 6, 2017 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.