Learn how to use the Liquid templating language within DecoNetwork order templates to insert dynamic order data, apply conditional logic, and format content. This crash course is tailored specifically for the variables and contexts available in DecoNetwork templates.
In This Article
- Why use Liquid in DecoNetwork templates
- Step 1: Understand Liquid basics
- Step 2: Insert and format variables
- Step 3: Add logic and loops
- Step 4: Apply filters
- Best-practice tips
- Troubleshooting common issues
- Additional Resources
Why use Liquid in DecoNetwork templates
Liquid is the templating language that powers DecoNetwork order templates. Instead of static HTML, Liquid lets you:
- Insert dynamic data like order numbers, customer names, and line items.
- Apply conditional logic (e.g., only show discounts if they exist).
- Loop through collections (e.g., all items in an order).
- Format and transform content using filters (e.g., format currency, truncate text).
Step 1: Understand Liquid basics
Liquid syntax uses double curly braces for variables and tags inside {% %} for logic.
-
Output variable:
{{ order.customer_name }} -
Logic tag:
{% if order.discount 0 %} ... {% endif %} -
Loop tag:
{% for item in order.line_items %} ... {% endfor %}
Step 2: Insert and format variables
Variables are placeholders for order data. Some common ones include:
-
{{ order.id }}– the order number -
{{ order.customer_name }}– the customer’s full name -
{{ order.total_price }}– the total price -
{{ order.shipping_address }}– formatted shipping address
Step 3: Add logic and loops
Use Liquid tags to control template flow:
{% if order.discount_amount 0 %}
<p>Discount: {{ order.discount_amount }}</p>
{% endif %}
{% for item in order.line_items %}
<tr>
<td>{{ item.sku }}</td>
<td>{{ item.quantity }}</td>
</tr>
{% endfor %}
Step 4: Apply filters
Filters let you format output:
-
{{ order.total_price | currency: "USD" }}– format as currency -
{{ order.date | date: "%B %d, %Y" }}– format as a human-readable date -
{{ item.name | upcase }}– convert to uppercase -
{{ order.notes | default: "No special instructions." }}– provide a fallback value
Best-practice tips
- Always wrap optional content in
{% if %}checks to avoid blank gaps. - Use
{% comment %} ... {% endcomment %}to document your customizations. - Test in small increments: edit → save → preview → adjust.
- Use consistent naming and formatting to make templates easy to maintain.
Troubleshooting common issues
- Blank output: Variable not available in this context. Check the reference list.
-
Syntax error: Ensure every
{% if %}has a matching{% endif %}, and each{% for %}has a closing{% endfor %}. -
Weird spacing: Use
{{- variable -}}to trim whitespace.
Additional Resources
- Official Shopify Liquid reference
- Order Templates in DecoNetwork
- Order Template Variables Reference (DecoNetwork)
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.