Email templates in DecoNetwork use HTML and CSS for layout and styling, but they also include the Liquid template language. Liquid gives you the power to dynamically insert customer details, order data, and conditional content into your emails. This crash course is tailored specifically for the variables and contexts available in DecoNetwork email templates.
In this Article
Why Liquid is Used in DN Email Templates
Liquid is the templating language that powers the dynamic parts of your DN email templates. Instead of hardcoding text, Liquid allows you to:
- Insert customer names, order numbers, and other variables directly into emails.
- Show or hide blocks of content based on conditions (e.g., “only display shipping tracking if available”).
- Format dates, numbers, and text in user-friendly ways.
Liquid Basics
Liquid uses three main types of markup:
-
Output:
{{ variable }}→ Displays the value of a variable. -
Filters:
{{ variable | filter }}→ Modifies the output (e.g., uppercasing text). -
Tags:
{% tag %}→ Controls logic and flow (loops, conditions, etc.).
Variables
Variables hold data from DecoNetwork, such as order details or customer information. In DN email templates, you’ll often see variables like:
-
{{ customer.first_name }}→ Displays the customer’s first name. -
{{ order.number }}→ Shows the order number. -
{{ order.total | money }}→ Formats the total as a currency amount.
Filters
Filters modify output before it’s displayed. Common examples include:
-
{{ customer.email | upcase }}→ Converts the email address to uppercase. -
{{ order.created_at | date: "%B %d, %Y" }}→ Formats the date as “September 26, 2025”. -
{{ order.total | money }}→ Formats the order total as a currency.
Tags (Logic and Control)
Tags let you add conditions, loops, and comments. Examples:
-
If statements:
{% if order.shipping_tracking %} Track your order here: {{ order.shipping_tracking }} {% endif %} -
Loops:
{% for item in order.line_items %} {{ item.name }} - {{ item.quantity }} {% endfor %} -
Comments:
{% comment %} This will not appear in the email {% endcomment %}
Practical Examples
Example snippet from an Order Confirmation template.
Here’s a simple Order Confirmation snippet:
Hi {{ customer.first_name }},
Thank you for your order #{{ order.number }} placed on
{{ order.created_at | date: "%B %d, %Y" }}.
Your order total is {{ order.total | money }}.
{% if order.shipping_tracking %}
You can track your shipment here: {{ order.shipping_tracking }}
{% endif %}
Best-Practice Tips
- Always test emails before sending to customers—Liquid errors can break the template.
- Use conditional tags (
{% if ... %}) to avoid showing empty fields (like missing tracking numbers). - Keep your Liquid simple—start with variables and filters, then add loops and conditions as needed.
Troubleshooting Common Issues
-
Blank output: If a variable returns nothing, check that the field actually exists for that order or customer. Use an
{% if variable %}condition to prevent empty placeholders. -
Template errors: A missing closing tag (
{% endif %}) or loop ({% endfor %}) will break the template. Always double-check your opening and closing pairs. -
Wrong formatting: If currency or dates look odd, ensure the correct filter is applied (e.g.,
| money,| date). -
Showing code instead of output: If you see
{{ variable }}printed in the email, it means DN didn’t recognize it. Verify you used a supported variable name. -
Extra spaces or line breaks: Liquid respects whitespace. Use
{{- ... -}}or{%- ... -%}to trim unwanted spaces.
Additional Resources
- Shopify Liquid Documentation (official language reference)
- Email Template Variable Descriptions
- Email Templates
Still have questions? Use the Search Tool at the top of the page to find more related guides. Need help? Click the icon to submit a support ticket—our Client Services team is ready to assist!
Comments
0 comments
Please sign in to leave a comment.