Comma separated list of order tags in shipping email notification

Solved
Deam
Tourist
7 1 2

Hello

 

I have orders that have multiple tags and would like to use them in my shipping notification emails. I will want to have this list of tags in multiple areas of the same email messages.

 

Ideally I want to introduce the new variable and assign all tags to it

{% assign tags = ...

where {{ tags }} = "tag1,my other tag,yet another tag on this order"

 

How do I do that?

 

0 Likes
BrianAtWork
Shopify Partner
242 58 133

Hi @Deam,

 

Try this code to print a comma separated list of order tags in your shipping notification emails:

 

{%- for tag in tags -%}{{ tag }}{%- if tags.last != tag -%}, {%- endif -%}{%- endfor -%}

Let me know if this answers your question or if you need further help!

Brian | Shopify Partner | Ecommerce Consultant
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution  
 - Need further assistance? Visit www.BrianAtWork.com

0 Likes
Deam
Tourist
7 1 2

This is an accepted solution.

Hi Brian

 

Thank you so much for sending the code.

For whatever reason, your code was returning no results in the emails, so I ended up building this:

 

{% if order.tags.size > 0 %}{% assign tag = order.tags | join: ',' %}{% endif %}

that got it working...