All things Shopify and commerce
Afternoon,
This code seems to be doing what I need it to do which is only send a notification if the tag matches "Name of Tag"
However if I add in 2 products I get the content twice in the same email. Example: Hi jeffrey, is 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, based on your selection. Hi jeffrey, is 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, based on your selection.
Goal is that if a tag "Tag"... I get this "Your order contains a pre-order item. Please check your site for dates for delivery to a Campus for distribution. If you have any questions please reachout to your manager."
and if no tag I should get this "Hi jeffrey, is 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, based on your selection."
Just need a way to not get it twice.
Code:
{% capture email_title %}
{% if has_pending_payment %}
Thank you for your order from US!
{% else %}
Thank you for your purchase from US!
{% endif %}
{% endcapture %}
{% capture email_body %}
{% if has_pending_payment %}
{% if buyer_action_required %}
You’ll get a confirmation email after completing your payment.
{% else %}
Your payment is being processed. You'll get an email when your order is confirmed.
{% endif %}
{% else %}
{% if requires_shipping %}
{% for line in line_items %}
{% if line.product.tags contains "WM-Weight" %}
Your order contains a pre-order item. Please check your site for dates for delivery to a Campus for distribution. If you have any questions please reachout to your manager.
{% else%}
Hi {{ customer.first_name }}, is 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, based on your selection.
{% endif %}
{% endfor %}
Solved! Go to the solution
This is an accepted solution.
Hi @Shubz
Please try this code
{% capture email_title %}
{% if has_pending_payment %}
Thank you for your order from US!
{% else %}
Thank you for your purchase from US!
{% endif %}
{% endcapture %}
{% capture email_body %}
{% if has_pending_payment %}
{% if buyer_action_required %}
You’ll get a confirmation email after completing your payment.
{% else %}
Your payment is being processed. You'll get an email when your order is confirmed.
{% endif %}
{% else %}
{% if requires_shipping %}
{% assign wmWeightProduct = false %}
{% for line in line_items %}
{% if line.product.tags contains "WM-Weight" %}
{% assign wmWeightProduct = true %}
{% break %}
{% endif %}
{% endfor %}
{% if wmWeightProduct %}
Your order contains a pre-order item. Please check your site for dates for delivery to a Campus for distribution. If you have any questions please reachout to your manager.
{% else %}
Hi {{ customer.first_name }}, is 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, based on your selection.
{% endif %}
This is for your messaging only,
If there is another loop that is used to display product information, please don't update that, keep that same
Please check if it is helpful to you.
Thanks!
This is an accepted solution.
Hi @Shubz
Please try this code
{% capture email_title %}
{% if has_pending_payment %}
Thank you for your order from US!
{% else %}
Thank you for your purchase from US!
{% endif %}
{% endcapture %}
{% capture email_body %}
{% if has_pending_payment %}
{% if buyer_action_required %}
You’ll get a confirmation email after completing your payment.
{% else %}
Your payment is being processed. You'll get an email when your order is confirmed.
{% endif %}
{% else %}
{% if requires_shipping %}
{% assign wmWeightProduct = false %}
{% for line in line_items %}
{% if line.product.tags contains "WM-Weight" %}
{% assign wmWeightProduct = true %}
{% break %}
{% endif %}
{% endfor %}
{% if wmWeightProduct %}
Your order contains a pre-order item. Please check your site for dates for delivery to a Campus for distribution. If you have any questions please reachout to your manager.
{% else %}
Hi {{ customer.first_name }}, is 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, based on your selection.
{% endif %}
This is for your messaging only,
If there is another loop that is used to display product information, please don't update that, keep that same
Please check if it is helpful to you.
Thanks!
Thank you so much I see the error in my ways 🙂 So one last question? {% if line.product.tags contains "WM-Weight" %} can you use an or statement and look for several tags that are different? I might need that in the future.
Yes, you can use multiple or statement in that if, then it will show if any of the tag is present on products
Thanks
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025