Help with editing order confirmation email

Solved

Help with editing order confirmation email

ProSharp
Visitor
2 0 0

Hello, I am trying to add a section of text to my order confirmation email when a specific item, or when an item with a certain tag is purchased. I understand the only way to do this is by editing the code of the email... Can anyone help me and provide the code needed? Ideally this will be based off of the line item tag if possible, so If order contains line item with tag of "X", then display a paragraph, else don't display. 

Thank you

Accepted Solution (1)

CodingFifty
Shopify Partner
903 136 164

This is an accepted solution.

Hi @ProSharp,

 

Code Example:
You can use the order.line_items loop to check for the tag:

{% for line_item in order.line_items %}
  {% if line_item.product.tags contains 'X' %}
    <p>Thank you for your order! Since your purchase includes [Product with X Tag], here is some important information for you...</p>
    {% break %}
  {% endif %}
{% endfor %}


This loop goes through each line item in the order.
If any product has the tag "X", it will display a custom message.
{% break %} stops the loop as soon as a matching product is found, preventing duplicate messages.

Coding Fifty || Shopify Partner
For any custom section queries, please visit: Fiverr Profile
Found my response useful? Like it and mark as Accepted Solution!
For additional discussions, reach out via: Email ID: codingfifty@gmail.com

View solution in original post

Replies 2 (2)

CodingFifty
Shopify Partner
903 136 164

This is an accepted solution.

Hi @ProSharp,

 

Code Example:
You can use the order.line_items loop to check for the tag:

{% for line_item in order.line_items %}
  {% if line_item.product.tags contains 'X' %}
    <p>Thank you for your order! Since your purchase includes [Product with X Tag], here is some important information for you...</p>
    {% break %}
  {% endif %}
{% endfor %}


This loop goes through each line item in the order.
If any product has the tag "X", it will display a custom message.
{% break %} stops the loop as soon as a matching product is found, preventing duplicate messages.

Coding Fifty || Shopify Partner
For any custom section queries, please visit: Fiverr Profile
Found my response useful? Like it and mark as Accepted Solution!
For additional discussions, reach out via: Email ID: codingfifty@gmail.com
ProSharp
Visitor
2 0 0

Thank you so much, that worked very nicely! I do have one more question- I want to insert a link in the paragraph that I will be showing, is that possible?