I am hoping one of you can help figure out the best way to modify a bit of code in my “Order Confirmation Email”.
A hand full of products I sell require VERY specific shipping and I’d like to have the text in the main body of the confirmation email include those instructions for those products; but only for orders with those products.
As best I can tell, the best way to differentiate one of the specific shipping products from the others is by using product tags as a variable. I’d like to write a small bit of code that will look at the tags of the products ordered and, if a product has one of the predetermined tags, give those instructions in the email.
For example:
If a product has tag “A”, “Shipping instructions A”
If a product has tag “B”, “Shipping instructions B”
If neither tag is associated with any product in the order, “thanks for your order”.
I have tried a million ways and none seem to work. My best guess so far looks something like this:
{% capture email_body %} {% for tag in line.product.tags %}
{% if tag == ‘A’ %} “Instructions for products with “Tag A””
{% elsif tag == ‘B’ %} “Instructions for products with “Tag B””
{% else %} “Thanks”
{% endif %}
{% endfor %} {% endcapture %}
Thank you in advance for any help you can give me!