Skip to content

Shopify Dude Fix

Why Does Liquid Work in a Shopify Notification but Fail in Shopify Email?

Liquid copied from a Shopify notification can fail in Shopify Email because the two surfaces do not share the same variables or message context.

Quick answer: Shopify notification templates and Shopify Email campaigns use different message contexts. Order notification variables such as line items, fulfillments, and transaction data cannot be copied into a customer-marketing email unless that email’s context actually provides the same objects.

The real symptom

  • Liquid works in an order confirmation or shipping notification.
  • The same code outputs blank in Shopify Email.
  • Variables such as subtotal_line_items or order-specific totals are missing.
  • A Flow-triggered marketing email has different data than a transactional notification.

Likely causes

  • The notification object model is not the Shopify Email object model.
  • The email is sent to a customer segment, not a specific order.
  • The Flow trigger supplies customer data but not order line-item data.
  • A variable is available only after an event such as fulfillment or payment capture.

Fix path

  1. Identify where the email is being built: Notifications, Shopify Email, or Flow.
  2. Open the variable reference for that surface.
  3. Replace order-notification variables with objects available to that email type.
  4. For order-specific messaging, use a transactional notification or Flow triggered by an order event.
  5. Test with a real object that contains the data you reference.

Simple checks

  • Preview data can be incomplete; test with a real order when order data matters.
  • If the email is customer-segment based, do not expect line-item arrays.
  • Use simple output first, then add conditions.

Useful code or DevTools check

{% if subtotal_line_items %}
  {% for line in subtotal_line_items %}
    {{ line.title }}
  {% endfor %}
{% endif %}

This belongs in a notification context where the variable exists, not a generic marketing email.

Do not do this

Do not treat “Liquid supported” as “every Shopify Liquid object is available.” Each Shopify email surface has its own scope.

Sources