<p>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!)</p>

<p>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.</p>

CC BY-SA 3.0
2017-07-05T12:27:04.023Z
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
CC BY-SA 3.0
2017-07-06T12:40:19.320Z
@carlcs That's a great idea, might do that in future. Always had issues using custom variables etc across templates
Jason Mayo
CC BY-SA 3.0
2017-07-05T08:57:54.637Z
2017-07-05T08:57:54.637Z
Jason Mayo
<p>You don't need to create your own symbol map - it exists as a yii translation:</p>

<pre><code>{% set localeData = craft.i18n.getLocaleData() %}
{% set currencyIso = 'USD' %}

{{ localeData.getCurrencySymbol(currencyIso)  }}
</code></pre>

CC BY-SA 3.0
2017-07-06T12:40:39.257Z
Wish I'd known this on a previous project! Upvoted!
Jason Mayo
CC BY-SA 3.0
2017-07-10T09:08:56.307Z
@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.
Oliver Stark
CC BY-SA 3.0
2017-07-05T13:12:27.410Z
2017-07-05T13:12:27.410Z
Oliver Stark
<p>Is there a way to output the currency symbols for each accepted payment currency in a Craft Commerce site?</p>

<p>Consider the following simplified example;</p>

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

<p>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.</p>

<plugin-craftcommerce><currency>
Output currency symbols
# Output currency symbols

(Asked by: username_0 on 2017-07-05)

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 %}

    {% for currency in currencies %}
        {{ currency.iso }}
    {% 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.

**Tags:** plugin-craftcommerce, currency


---

## 2 answers

### Answer by username_3 on 2017-07-05. Score: 4 | Accepted answer

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)  }}

> **Comments:**
> **username_1**: Wish I'd known this on a previous project! Upvoted!  
> **username_3**: @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.  

---

### Answer by username_1 on 2017-07-05. Score: 2

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.

> **Comments:**
> **username_2**: 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') %}`.  
> **username_1**: @username_2 That's a great idea, might do that in future. Always had issues using custom variables etc across templates  

---

