Currency for "Amount in words"

If you copy the theme you are using to a custom theme and insert this code:

{% capture amount %}{% for total in table.totals %}{% if total.label == "Total" %}{{ total.text }}{% endif %}{% endfor %}{% endcapture %}
{% capture anc %}{% for total in table.totals %}{% if total.label == "Total" %}{% assign an=total.number %}{% endif %}{% endfor %}{% endcapture %}
{% capture amount_in_words %}{% for total in table.totals %}{% if total.label == "Total" %}{{ total.number | spell_out }}{% endif %}{% endfor %}{% endcapture %}
{% capture cents%}{{an| plus: 0 | modulo: 1| times: 100 | round: 0}}{%endcapture%}
{% capture cents_in_words %}{% if cents != "0" %}{{cents|prepend: " and " | append: "/100 "}}{%else%} Only{% endif %}{% endcapture %}
{{amount_in_words}}{{cents_in_words}}

You will produce this when there are nothing after the decimal point


And this when there are cents.

I am located in United States and I am not familiar with the notation of your currency, but if you want to add the currency before it, you can do so by putting AED before the

{{amount_in_words}}{{cents_in_words}}

in the last line of the copy I gave you. Hope this helps.

3 Likes