Currency for "Amount in words"

Hi,
Is there a way to put the currency with the “Amount in words”.
For example; I am from UAE and the currency here is AED/Dirhams.
An invoice amounted for 100.00; when selected “Amount in words” shows, “One Hundred only”.
Is there a way to add “AED One hundred only” or “Dirhams One hundred only”.

if there is a way, please share your tricks.

There is no method.

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

Hello & thanks for sharing this. If I want to “Four Million Six Hundred Thousand Only” into “Forty Six Lakh Only” which is 4,600,000.00. Maybe it’s Indian Currency Format. How can I do this plz?

You cannot do that. The software function returns only an English equivalence of a number. It performs no currency conversions and assigns no currency symbols, codes, or names.

:angry: :angry: :angry:
Why every time everywhere you said only just “NO”? :sob:
Manager authority can be added in future if they got this important for us.
I’m a PHP programmer, I know it’s not possible without there permission.
Thanks! :slightly_frowning_face:

What @Tut is talking about is the lack native functions or filters to achieve your goals. But you can definitely endeavor to create your own liquid script to do whatever you want to do within the limits of liquid. The developer allowed this and it’s a super useful feature.

You should try it.

That’s a great start. That also means that you shouldn’t struggle learning liquid, that is if you don’t know it already.

2 Likes