When creating your own contract or invoice-templates, you might stumble upon a template error or a liquid error. This means that there is something wrong in your code, so the system can't read it.
This article will help you find a solution to these problems.
Let's go trough the various Template Error's.
Liquid syntax error: 'for' tag was never closed
When you started a for-loop, it must be ended for it to function. If not ended, your template will always show the Template Error as above.
For example:
{% for e in events %}
{{ e.fee }}
The for-loop is incomplete.
The correct code should be:
{% for e in events %}
{{ e.fee }}
{% endfor %}
Liquid syntax error: 'if' tag was never closed
Similar to above;
The if-statement.
Below is an incorrect 'if' statement displayed. We start the statement, but we forgot to tell the system to close the statement
{% if event.fee > 0 %}
{{ event.fee }}
The correct code would be:
{% if event.fee > 0 %}
{{ event.fee }}
{% endif %}
Liquid syntax error: Variable was not properly terminated
Incomplete variables will also cause an error. Variables should always was {{ and }}.
{{ contact.contact_name }
You see that the last '}' is missing here.
Liquid error: Unknown operator =
When checking something in an if-statement, you need to use ==.
For example:
{% if event.fee = 0 %}
If you do it as above, your template will give you a liquid error.
The correct code should be:
{% if event.fee == 0 %}
Contact Support if you have difficulty with this or need additional help.