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 %}
User | RANK |
---|---|
193 | |
177 | |
84 | |
58 | |
45 |
Transform this holiday season into a shopping spree. Plus, learn how to effortlessly open ...
By Jasonh Dec 8, 2023Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023