How to vary the text inside the Order confirmation email depending on the product purchased

Highlighted
New Member
2 0 0

Hi, I need to delivery different piece of content in the order confirmation email, depending on which product the customers has purchased.

 

I'm now using this code:

{% for line in line_items %}{% if line.title contains 'Tropical Save the Date Invitations Video' %}Please complete the Tropical Wedding Invitation Video ORDER FORM HERE.{% endif %}{% endfor %}

 

{% for line in line_items %}{% if line.title contains 'Blush Navy Save the Date Wedding Invitation Video' %}Please complete the Blush Navy Save the Date Wedding Invitation Video ORDER FORM HERE.{% endif %}{% endfor %}

 

this code above works well and display in the email.

 

I also want to add another variable if possible to show some different texts depending on the tag of the product purchased. I tried this variable below but doesn't work:

 

{% for line_item in line_items %}{% for tag in line_item.product.tags %}{% if tag == ‘Email invitations’ %}

You will receive an email shortly (usually immediately) from Corjl.com with a link to access and edit your file.

% endif %}{% endfor %}

 

So in total the content of my email looks like this:

{% for line in line_items %}{% if line.title contains 'Tropical Save the Date Invitations Video' %}Please complete the Tropical Wedding Invitation Video ORDER FORM HERE.{% endif %}{% endfor %}

 

{% for line in line_items %}{% if line.title contains 'Blush Navy Save the Date Wedding Invitation Video' %}Please complete the Blush Navy Save the Date Wedding Invitation Video ORDER FORM HERE.{% endif %}{% endfor %}

 

{% for line_item in line_items %}{% for tag in line_item.product.tags %}{% if tag == ‘Email invitations’ %}

You will receive an email shortly (usually immediately) from Corjl.com with a link to access and edit your file.

% endif %}{% endfor %}

 

Can anyone help with this? I tried to formulate this variables looking at the topics in the forum but I might have missed some part.

 

Thank you! Marianna

0 Likes
Shopify Partner
100 19 18

Hi @marianna1378 ,

 

Hope you are doing well,

 

Please change your third variable code with this. It will solve your issue.

 

{% for line_item in line_items %}
{% for tag in line_item.product.tags %}
{% if tag == ‘Email invitations’ %}
You will receive an email shortly (usually immediately) from Corjl.com with a link to access and edit your file.
{% endif %}
{% endfor %}
{%endfor%}

 

 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: codecorneres@gmail.com
Skype: code.corners
0 Likes
New Member
2 0 0

Hi Thank you so much for your advice!

I have placed this code in the email but the part with the tag is still not working.

 

{% for line in line_items %}{% if line.title contains 'Tropical Save the Date Invitations Video' %}Please complete the Tropical Wedding Invitation Video ORDER FORM HERE.{% endif %}{% endfor %}

 

{% for line in line_items %}{% if line.title contains 'Blush Navy Save the Date Wedding Invitation Video' %}Please complete the Blush Navy Save the Date Wedding Invitation Video ORDER FORM HERE.{% endif %}{% endfor %}

{% for line_item in line_items %}

{% for tag in line_item.product.tags %}

{% if tag == ‘Email invitations’ %}

You will receive an email shortly (usually immediately) from Corjl.com with a link to access and edit your file.

{% endif %}

{% endfor %}

{%endfor%}

 

I have placed the tag in the product page (right column), is there any other place I should insert this tag in order for the code to work?

Thank you!

Marianna

0 Likes
Shopify Partner
100 19 18

try this {% if tag contains ‘Email invitations’ %} instead of {% if tag == ‘Email invitations’ %}.

i hope this will solve your issue.

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: codecorneres@gmail.com
Skype: code.corners
0 Likes