Solved

Attempting to modify the Confirmation email using tags

Shubz
Shopify Partner
8 0 1

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 %}

 

Accepted Solution (1)

pawankumar
Shopify Partner
528 68 92

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!


- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan

View solution in original post

Replies 3 (3)

pawankumar
Shopify Partner
528 68 92

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!


- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan
Shubz
Shopify Partner
8 0 1

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. 

pawankumar
Shopify Partner
528 68 92

Yes, you can use multiple or statement in that if, then it will show if any of the tag is present on products

 

Thanks 

- Need a Shopify developer? Chat on WhatsApp +91-9467121281
- Coffee Tip: Buymeacoffee  | Email: thepkpawankumar@gmail.com
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Best regards,
Pawan