Help with editing order confirmation email

Topic summary

A user needs to conditionally display text in Shopify order confirmation emails based on product tags. Specifically, they want to show a custom paragraph only when an order contains items tagged with “X”.

Solution Provided:

  • Use Liquid templating to loop through order.line_items
  • Check if line_item.product.tags contains 'X'
  • Display custom message when condition is met
  • Include {% break %} to prevent duplicate messages

Code snippet shared demonstrates the complete implementation.

Current Status:

  • Initial solution successfully implemented
  • Follow-up question raised about adding hyperlinks within the conditional paragraph
  • Discussion remains open, awaiting response on link insertion
Summarized with AI on October 31. AI used: claude-sonnet-4-5-20250929.

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' %}
    

Thank you for your order! Since your purchase includes [Product with X Tag], here is some important information for you...

    {% 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.

1 Like