Elsif Product.Tags Contains Issue in Confirmation Emails

Solved
Highlighted
Tourist
7 0 1

I am trying to get our confirmation emails to show lead time tags as the longest lead time of the products in their cart, however it seems to not be functioning and I'm hoping to get some insight as to where I went wrong. Here's the code from our confirmation email template:

   {% if product.tags contains 'pre-order' %}
            <div class="lead-time"><strong>Your cart contains  one or more pre-order items, visit the product page for a current fulfillment estimation.</strong></div>
          {% elsif product.tags contains '6-8week' %}
            <div class="lead-time">Production Lead Time Estimate: 6-8 Weeks</div>  
          {% elsif product.tags contains '3week' %}
            <div class="lead-time">Production Lead Time Estimate: 3 Weeks</div>
          {% elsif product.tags contains '1week' %}
            <div class="lead-time">Production Lead Time Estimate: 1 Week</div>
          {% elsif product.tags contains 'quick ship' %}
            <div class="lead-time">Production Lead Time: 3-5 Business Days</div>
          {% elsif product.tags contains '3-5days' %}
            <div class="lead-time">Production Lead Time Estimate: 3-5 Business Days</div>
      {% else %}
    <div class="lead-time">Production Lead Time Estimate: 2-4 Weeks</div>
          {% endif %}

 

Basically I want it to scan the product tags and go down the list and the first one that matches, return that message and then stop looking. If it doesn't find any tags that match, it can put the standard lead time. However, I have run several tests with an item that has a 6-8week tag on it and it keeps giving confirmation emails populated with the standard 2-4 week message. Anyone see what I've done incorrectly here? Thank you!

0 Likes
Highlighted
Shopify Partner
262 24 30

Hi,

product object directly not accessible, you need to assign before use

If helpful then please Like and Accept Solution.
Email: suhagiyajivan1992@gmail.com
Skype: jivan.suhagiya
Give a try to Shopify APP: https://apps.shopify.com/short-track
0 Likes
Highlighted
Tourist
7 0 1

Forgive the ignorance, I'm really new to this, but what do you mean by that? Thank you!

0 Likes
Highlighted
Shopify Partner
262 24 30

See, you are checking product.tags, but what is "product" object in this case? You need to assign product = some product before use 

If helpful then please Like and Accept Solution.
Email: suhagiyajivan1992@gmail.com
Skype: jivan.suhagiya
Give a try to Shopify APP: https://apps.shopify.com/short-track
0 Likes
Highlighted
Tourist
7 0 1

Okay, that makes sense, but in this case I want it to look at all the products in the order and all of their tags and then act based on the longest lead time of all the products in the cart. Is there a way to assign product to be all products in the order?

0 Likes
Highlighted
Shopify Partner
262 24 30

This is an accepted solution.

 

{% assign all_products_tags = '' %}
{% for line in line_items %}
	{% assign product_tags = line.product.tags %}
	{% assign all_products_tags = all_products_tags | concat: product_tags %}
{% endfor %}
{% if all_products_tags contains 'something' %}
.... Yuor stuff here...
{% endif %}


 

If helpful then please Like and Accept Solution.
Email: suhagiyajivan1992@gmail.com
Skype: jivan.suhagiya
Give a try to Shopify APP: https://apps.shopify.com/short-track
1 Like
Highlighted
Tourist
7 0 1

Thank you so much, this worked beautifully!

0 Likes