Quantcast
Channel: Opinion: Shopify Community - Shopify & Ecommerce Jobs
Viewing all articles
Browse latest Browse all 7259

Britton Jenner commented on Different Confirmation Emails Based on Product Selected.

$
0
0

Hi Tom,

Britton here with the Shopify support team.

You should be able to add this code snippet to your order confirmation email template to accomplish that goal:

{% assign totalTags = "" %}
{% for line in line_items %}
{% capture tagList %}{{ line.product.tags | join: ", " }}{% endcapture %}
{% capture totalTags %}{{ totalTags | append: tagList }}{% endcapture %}
{% endfor %}

{% if totalTags contains 'test' %}
<p>The test message goes here</p>
{% endif %}

Essentially, that code checks all of the tags associated with all products in the order to see if one matches "test". If it does, the message prints and if it doesn't then the message does not print. You will want to change the tag 'test' on line 7 above to something that makes more sense with your products.

Bear in mind that you will need to tag all of the products that you want to trigger this with the relevant tag. Also, make sure that said tag is not similar to other tags. For instance, if I also had products tagged with 'test1' in the above example they would trigger the message even though I don't want them to! This is because test is a substring of test1. Avoid those kinds of tags and you should be ok :)

I hope that helps!

-Britton


Viewing all articles
Browse latest Browse all 7259

Trending Articles