Customizing the customer order confirmation e-mail based on Product tags

Shopify Partner
4 0 0

I am looking to modify the customer's order confirmation e-mail depending on specific product tags for the products that they ordered.

I was able to add this functionality to the product cart, but the same code does not seem to work in the e-mail form.

    {% assign test = 'False' %}
    {% for item in cart.items %}
        {% if item.product.tags contains 'test' %}
            {% assign test='True' %}
    {% endif %}
    {%endfor%}

Interestingly It also does not kick out any errors either.

Of course I add the functionality later in the e-mail form.

{% if test == 'True' %}

 <add custom text here >

{% endif %}

Any suggestions would be greatly appreciated.

Thanks

Evan

 

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
582 0 45

Are you talking about the email form after an order has been placed? I believe you are working with different items at that point. You should be working with order instead of cart.

0 Likes
Shopify Partner
4 0 0

Yes, I am talking about the e-mail form for the order confirmation.   So the question perhaps should be rephrased as, how do I access the item tag information from the order confirmation e-mail form.

 

Thanks

Evan

 

0 Likes
Shopify Staff
Shopify Staff
582 0 45

You probably want order.line_items

0 Likes