Legend of liquid array for Developing Email Template

Can @tut add additional workable liquid array other than {{reference}} in guide that we can use . It will be easier for someone like myself to have quick reference. While, Developing Email Templates. :roll_eyes:

1 Like

I don’t have a list of other variables. The Guide about email templates was adapted from one written by the developer, which only mentioned the one variable. But they will be the same ones visible in code for themes. Other users have posted some lists they developed in the past. Search the forum.

here is an email template for sales invoice i am using which other users may find useful.

Subject
Invoice Number {{reference}}

Message body
Greetings M/s. {{ recipient.name }},<br><br>Please find herewith attached your Invoice Number {{reference}} dated {% for field in fields %}{% if field.label == 'Invoice date' %}{{ field.text }}{% endif %}{% endfor %}<br>The Invoice value is {% for total in table.totals %}{% if total.label == 'Total' %}<b>{{ total.text }}</b>{% endif %}{% endfor %}<br>{% for total in table.totals %}{% if total.label == 'Balance due' %}{% if total.text !='' %}The balance amount due is <b>{{ total.text }}</b>{% endif %}{% endif %}{% endfor %}<br><br>If payment not made already, please make payment to the below bank account.<br><br>**Your bank details here**

this template gets the following details necessary for a customer:
Invoice number
Invoice date
Invoice value
Balance due
Bank details

9 Likes

Thank you!
In The Netherlands we use the iDeal paying method. I was looking for the code to make it possible for the client to pay the invoice, via a link, as soon as I send him the email.
Now I can, so thank you!

Thank you!

I wrote a better way referenced to Lubos post. on Request to add variables into email body - #9 by lubos

and Based on @sharpdrivetek gracious shared template.

Subject
Invoice Number {{ reference }} due to {{ business.name }} ({{ business.identifier }})

Message Body
{% for total in table.totals %}{% if total.label == ‘Total’ %}{% capture invoice_total %}{{ total.text }}{% endcapture %}{% endif %}{% endfor %}
{% for field in fields %}{% if field.label == ‘Invoice date’ %}{% capture invoice_date %}{{ field.text }}{% endcapture %}{% endif %}{% endfor %}
{% for field in fields %}{% if field.label == ‘Due date’ %}{% capture due_date %}{{ field.text }}{% endcapture %}{% endif %}{% endfor %}
{% for total in table.totals %}{% if total.label == ‘Balance due’ %}{% capture balance_due %}{{ total.text }}{% endcapture %}{% endif %}{% endfor %}

    Greetings {{ recipient.name }},
    Please find herewith attached your Invoice Number {{ recipient.code }}-{{ reference }} dated {{ invoice_date }} due by {{ due_date }}
    The Invoice value is {{ invoice_total }}
    The balance amount due is {{ balance_due }}
    If payment have yet to be made, please pay to the following bank account:-
    <i>Bank:</i> <b>Zionist owned Bank namely IMF</b>
    <i>Account Holder:</i> <b>James Bond</b>
    <i>Account Number:</i> <b>777</b>

    Your People's Leader,
    Gadaffi from Libya

I need help of how to write up if logic like if there is no balance due it will display 0 and if there is no due date either display none or no due date template word. If there is example I am very appreciate.

Reference by @isklerius

2 Likes

Replace with so that if balance_due does not exist it will be 0
The balance amount due is {% if balance_due == null %} 0 {% else %} {{ balance_due }} {% endif %}

Same with … due by {{ due_date }}
{% if due_date == null %} no due by date {% else %} due by {{ due_date }} {% endif %}

1 Like

You’re the best @isklerius

Here is the improvised Template after adding @isklerius’s input.

Body Message

{% for total in table.totals %}{% if total.label == 'Total' %}{% capture invoice_total %}{{ total.text }}{% endcapture %}{% endif %}{% endfor %}
{% for field in fields %}{% if field.label == 'Invoice date' %}{% capture invoice_date %}{{ field.text }}{% endcapture %}{% endif %}{% endfor %}
{% for field in fields %}{% if field.label == 'Due date' %}{% capture due_date %}{{ field.text }}{% endcapture %}{% endif %}{% endfor %}
{% capture if_due_date %}{% if due_date == null %}.{% else %} due by <b>{{ due_date }}</b>.{% endif %}{% endcapture %}
{% for total in table.totals %}{% if total.label == 'Balance due' %}{% capture balance_due %}{{ total.text }}{% endcapture %}{% endif %}{% endfor %}
{% capture if_balance_due %}{% if balance_due == null %} RM 0.00 {% else %} {{ balance_due }} {% endif %}{% endcapture %}

Greetings {{ recipient.name }},
<br><br>
Please find herewith attached your Invoice Number <b>{{ recipient.code }}-{{ reference }}</b> dated <b>{{ invoice_date }}</b>{{ if_due_date }}
<br><br>
The Invoice amount is <b>{{ invoice_total }}</b><br>
The balance amount due is <b>{{ if_balance_due }}</b>
<br><br>
If payment have yet to be made, please pay by deposit to the following bank account with invoice number(s):-
<br><br>
<i>Bank:</i> <b>Zionist owned Bank namely IMF</b><br>
<i>Account Holder:</i> <b>James Bond</b><br>
<i>Account Number:</i> <b>777</b><br>
<br><br>
Your late Anti-Usury Leader,<br>
Gadaffi From Libya

@sharpdrivetek and @isklerius Thank you for sharing the samples, Is a steep curve learning for such as myself.

Those who wish to use my template please adjust accordingly. The only odd about my template is the Invoice number where I included recipient code as part of it. You may delete {{ recipient.code }}- to make it default format.

1 Like

i am facing problem here
using this

The balance amount due is {{ if_balance_due }}

if invoice is partially paid, it show correct data. but if none amount is paid, or full paid, it shows 0 balance in both conditions.

if i use {{ balance_due }} only, it still show 0 amount. for totally unpaid or totally paid invoices

any ideas how to correct it?

Actually is my mistake, I misunderstood the logic,

search the following line,

{% capture if_balance_due %}{% if balance_due == null %} RM 0.00 {% else %} {{ balance_due }} {% endif %}{% endcapture %}

Change ‘RM 0.00’ to ‘Unpaid’ or anything to describe the invoice yet to be paid.

Feedback to me if it works for you or not.

if the invoice is haven’t being paid it will show the ‘Unpaid’ text and if the invoice is being paid in full it will show RM 0.00 or partially paid it will show the differences amount of yet being paid respectively according to the sales invoice’s total.

1 Like

@sharpdrivetek ,I was trying to use your code’s email template, that’s fine, but when changing the language from English to Portuguese the outstanding balance shows zero, please help me fix it

You’ll have to change the English text after each == to the Portuguese equivalent.

@Mark thanks for the quick reply, i tried but it didn’t work

Then I’m afraid you’re doing something wrong. Can you post a screenshot of the invoice in Portuguese and the code you are using?

@Mark


And the code of the Email template in Settings? In Settings > Email settings you should also select HTML in Email sending format.

@Mark

I see you haven’t changed the English texts after == to Portuguese. They have to be the same as stated in the invoice, e.g. 2nd line ‘Invoice date’ should be ‘Data da fatura’, etc.

Better go with filed name. like {{ qty }} or {{ line.qty }}. that work for every language. Checking for every language a bit long in process.