Adding line properties to Order Confirmation Email

Topic summary

A developer is attempting to display line item properties (specifically pre-order and backorder notices with dates) in Shopify’s Order Confirmation email. While these properties successfully appear in the Admin Orders page, Cart, and Checkout, they don’t render in the email template.

Key Technical Questions:

  • Whether subtotal_line_items and line_items are interchangeable in email templates
  • How to properly access line properties within the email’s Liquid code
  • How to reference product metafields directly in emails to avoid storing data as properties

Solutions Provided:

Difference between variables: subtotal_line_items excludes tips while line_items includes them. They’re not identical, though interchangeable if tips aren’t used.

Accessing line properties: Instead of bracket notation (line.properties["Pre-Order"]), loop through properties directly using {% for p in line.properties %} for more reliable results.

Accessing metafields: Use line.product.metafields.namespace.key to reference product metafields through the line item.

A code example was shared demonstrating how to loop through and conditionally display line properties in the order confirmation email. The discussion references Shopify’s official email variables documentation for further guidance.

Summarized with AI on October 26. AI used: claude-sonnet-4-5-20250929.

Hi,

I’m trying to add line properties to the Order Confirmation email.
I have managed to pass the line properties through to Shopify Admin > Orders, Cart & Checkout however they do not show in the email confirmation.

I have noticed that the default email uses

{% for line in subtotal_line_items %}

Is that the same as using

{% for line in line_items %}

and am I able to change them?

The code below is what I have added to the confirmation, it is in the above mentioned for loop (subtotal_line_items). This is mainly to show customers that the item they have ordered is a pre-order or an item coming back in stock (incase they missed it when they placed the order) and to show the date.

The information is all stored in metafields which are passed to the product as properties in buy-buttons.liquid and card-product.liquid to show on Cart & Checkout and as far as I know it should be accessible to the email too.

 <span class="order-list__item-title">{{ line_title }}&nbsp;&times;&nbsp;{{ line_display }}</span><br/>
            
    {% if line.properties["Pre-Order"] == "Yes" %}
      <p style="margin: 5px 0 0 0; font-size: 13px; color: #555;">
      <strong>Pre-Order Notice:</strong> Estimated release date: <strong>{{ line.properties["Pre-Order Date"] }}</strong></p>
    {% endif %}
    {% if line.properties["Backorder"] == "Yes" %}
      <p style="margin: 5px 0 0 0; font-size: 13px; color: #555;">
      <strong>Backorder Notice:</strong> Estimated shipping date: <strong> {{ line.properties["Backorder Date"] }}</strong></p>
    {% endif %}
            
    {% if line.variant.title != 'Default Title' and is_parent == false %}

My theme is highly custom (made by a Shopify Partner) and as this is code I am adding myself I would like to know how to get it right rather than simply ask someone to do it for me.

If I can get it to work I would also like to know how to properly get product metafields to pass to the email also so I can remove the “properties[Pre-Order”] == “Yes” " from properties and use the metafield instead as I do not need this to show in my Admin Orders page.

Regards,

Hi @247GamesLtd :waving_hand:

subtotal_line_items excludes tips.

They are not the same
When in doubt first check the reference
https://help.shopify.com/en/manual/fulfillment/setup/notifications/email-variables

But if you are not taking tips now, or never will but if you do you will remember to fix it, then you can change the vars used.

As for line-item-properties(LIPs) first check they are actually working and passing through the cart, checkout and exist on the order itself.

Generally LIPs are key:hash pairs so it’s more verbose but works more often to loop over the properties itself and do the check inside that forloop for the LIPS; than trying to access the LIPs by bracket notation. https://help.shopify.com/en/manual/fulfillment/setup/notifications/email-variables#:~:text=for%20the%20item.-,line.properties,-Returns%20an%20array

For product metafields, you need to go through the line item to the PRODUCT.
Similar to how to get the title you have to go through the variant with {{ line.variant.title }}
So {{ line.product.metafields.key.namespace }}
line item != product.

Hi there,
To show properties of line item in the order confirmation, you can use this code:

{% assign property_size = line.properties | size %}
 {% if property_size > 0 %}
 {% for p in line.properties %}
 {% assign first_character_in_key = p.first | truncate: 1, '' %}
   {% unless p.last == blank %}
 {% if p.first contains '_is_preorder' %}
   <span class="order-list__item-variant">{{ p.last }}</span><br/>
 {% endif %}
 {% endunless %}
 {% endfor %}
{% endif %}

Sinh Developer, from Tipo