Conditional content in PDF templates with Liquid
If you've ever made 3 versions of the same template because some clients have VAT and others don't, this article saves you hours. Smart templates let one document handle every variation.
The problem
You have a template with this line:
VAT (20%): {{VAT}} EUR
But some clients are in non-VAT countries. For them, you want the VAT line gone — not "0 EUR", actually not there.
Old solution: maintain two templates. Update both when you change the design. Pick the right one per client. Inevitable mistakes.
The smart solution
Wrap the VAT line in an {% if %} block:
{% if VAT > 0 %}VAT (20%): {{VAT}} EUR
{% endif %}
One template. The line appears only when VAT > 0. When VAT is 0 or empty, it disappears entirely.
The full syntax (it's not scary)
If
{% if Status == "paid" %}
Thank you for your payment.
{% endif %}
If / else
{% if Country == "France" %}
Bonjour {{Client}},
{% else %}
Dear {{Client}},
{% endif %}
Comparison operators
== equal, != not equal, >, <, >=, <=, contains (substring).
Filters
{{ Amount | currency:"EUR" }} → 1,250.00 EUR
{{ Date | date:"MMMM dd, yyyy" }} → May 30, 2026
{{ Name | default:"Customer" }} → "Customer" if empty
{{ Country | upper }} → FRANCE
Loops (Pro+ only)
When a sheet cell contains a JSON array:
{% for item in Items %}
- {{ item.name }}: {{ item.price | currency:"EUR" }}
{% endfor %}
Your cell value: [{"name":"Apple","price":1.5},{"name":"Bread","price":3}]
Math (Pro+ only)
Subtotal: {{ Amount | currency:"EUR" }}
Tax (20%): {{ Amount * 0.20 | currency:"EUR" }}
Total: {{ Amount * 1.20 | currency:"EUR" }}
Three real-world recipes
Multi-region offer letter
{% if Country == "US" %}
At-will employment, eligible for company stock options after 12 months.
{% else %}{% if Country == "France" %}
CDI agreement, 5 weeks paid vacation, 13th month bonus.
{% endif %}{% endif %}
Conditional discount line
Subtotal: {{Subtotal}}
{% if DiscountPercent > 0 %}Discount ({{DiscountPercent}}%): -{{Discount}}
{% endif %}Total: {{Total}}
Adapt content to recipient seniority
{% if Years >= 5 %}
Welcome back, {{Name}}. As a long-time customer, you have access to our VIP program.
{% else %}
Welcome, {{Name}}. We're glad you're here.
{% endif %}
What plan do I need?
- Free: smart syntax stays as plain text (not rendered)
- Starter €5/mo: if/else, comparisons, filters
- Pro+ €60/mo: + loops, + math operations