Shopify themes, liquid, logos, and UX
I am trying to customize the Email Confirmation sent to customers, based on whether the order contains a product with the tag "pre-order." I have found various posts around this topic, and have tried every variation posted (that others claim to work for them) without any luck. Here is what I have currently. I have seen different variations on the "line.product.tags" and don't even know if I'm using the correct snytax here. Any help is appreciated!
{% capture email_title %}Thank you for your purchase! {% endcapture %}
{% capture email_body %}
{% if requires_shipping %}
{% if line.product.tags contains "pre-order" %}
Your order contains a pre-order item. All items in this order will ship with the pre-order, based on the timing provided on the item's product details.
{% else%}
Hi {{ customer.first_name }}, we're getting your order ready. Our current shipping/pickup time is approximately 2-3 days. We will notify you when it has been sent or is ready for pickup (along with curbside pickup time slot options), based on your selection.
{% endif %}
{% endif %}
{% endcapture %}
Solved! Go to the solution
This is an accepted solution.
THANK YOU! This worked when I ordered one item, but printed multiple messages when I ordered multiple items. I resolved that by further editing with a count:
{% capture email_title %}Thank you for your purchase! {% endcapture %}
{% capture email_body %}
{% if requires_shipping %}
{% assign count = 0 %}
{% for line in line_items %}
{% if line.product.tags contains "pre-order" %}
{% if count < 1 %}
{% assign count = count | plus: 1 %}
Your order contains a pre-order item. All items in this order will ship with the pre-order, based on the timing provided on the item's product details.
{% elsif count == 1 %}
Hi {{ customer.first_name }}, we're getting your order ready. Our current shipping/pickup time is approximately 2-3 days. We will notify you when it has been sent or is ready for pickup (along with curbside pickup time slot options), based on your selection.
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endcapture %}
can you replace your code and check please
{% for line in line_items %}
{% if line.product.tags contains "pre-order" %}
Your order contains a pre-order item. All items in this order will ship with the pre-order, based on the timing provided on the item's product details.
{% else%}
Hi {{ customer.first_name }}, we're getting your order ready. Our current shipping/pickup time is approximately 2-3 days. We will notify you when it has been sent or is ready for pickup (along with curbside pickup time slot options), based on your selection.
{% endif %}
{% endfor %}
it's should be work because line. product work in for loop only
This is an accepted solution.
THANK YOU! This worked when I ordered one item, but printed multiple messages when I ordered multiple items. I resolved that by further editing with a count:
{% capture email_title %}Thank you for your purchase! {% endcapture %}
{% capture email_body %}
{% if requires_shipping %}
{% assign count = 0 %}
{% for line in line_items %}
{% if line.product.tags contains "pre-order" %}
{% if count < 1 %}
{% assign count = count | plus: 1 %}
Your order contains a pre-order item. All items in this order will ship with the pre-order, based on the timing provided on the item's product details.
{% elsif count == 1 %}
Hi {{ customer.first_name }}, we're getting your order ready. Our current shipping/pickup time is approximately 2-3 days. We will notify you when it has been sent or is ready for pickup (along with curbside pickup time slot options), based on your selection.
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endcapture %}
Didn't work for me.
The less than operator "<" was the culprit in: {% if count < 1 %}.
Replaced statement with:
{% unless count >= 1 %}
. . .
{% else %}
. . .
{% endunless %}
Can you explain exactly where to insert this code? I have the same issue but I'm not that familliar with coding. Does it go in the email notification template HTML editor or in the theme editor? Thank you
Learn what's possible with customizing Shopify Checkout beyond what's available out of...
By Shopify Feb 19, 20252m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025