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 }} × {{ 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,