Custom order confirmation messaging depending on product

We have the order confirmation HTML taken from Klayvio.

I have mutule products where only on those specific products I need to add an additional line of text as they are made to measure products.

I want to simply create something like

{% if line_title contains ‘Item 1 or Item 2 or Item 3’ %}
You have purchased an item that is custom made. We want to make sure you have everything right so we’ll be contacting you shortly.
{% endif %}

Is this possible?

Hi @Ali_parr ,

Use this inside your line_items loop:

{% assign custom_items = 'Item 1,Item 2,Item 3' | split: ',' %}
{% for item in custom_items %}
  {% if line.title contains item %}
    <p>You have purchased an item that is custom made. We’ll contact you shortly.</p>
    {% break %}
  {% endif %}
{% endfor %}


replace Item 1,Item 2,Item 3 with your with your actual product names or title keywords.

Thanks

Manoj

Thankyou Manoj!

I did pop it in but I’m not sure if:

  1. I’ve put it in 100% the correct place
  2. If the name needs to be an exact match?
    1. Product name is :The Woolly Sprung Mattress Topper
    2. Product name that pulls in: The Woolly Sprung Mattress Topper - Single (90x190 cm)

@Ali_parr
use its name like this

 {% assign custom_items = ‘The Woolly Sprung Mattress Topper’ | split: ‘,’ %}{% for item in custom_items %}{% if line.title contains item %}You have purchased an item that is custom made. We’ll contact you shortly.{% break %}{% endif %}{% endfor %} 

If I help solve your query, please don’t forget to like it and mark it as solution.

Thanks

Maoj

Unfortunately still not pulling through but thankyou for supporting

I got it to work! Thankyou

Ready-to-paste snippet you can drop inside your order confirmation email template. It loops through each product in the order and adds your custom message if the product matches your condition:

{% for line in line_items %}
  <p>
    {{ line.title }}  
  </p>

  {% if line.title contains 'Item 1' 
     or line.title contains 'Item 2' 
     or line.title contains 'Item 3' %}
    <p style="color:#d9534f; font-weight:bold;">
      You have purchased an item that is custom made. We want to make sure you have everything right, so we’ll be contacting you shortly.
    </p>
  {% endif %}
{% endfor %}


:white_check_mark: This will:

  • Print each product name (line.title)

  • Show your custom message only for the items that match “Item 1”, “Item 2”, or “Item 3”.

  • Style the message a little (red and bold) so it stands out in the email — you can remove the style="" part if you want plain text.


:high_voltage: If you’d rather manage it by tagging products instead of hardcoding names (recommended, especially as your catalog grows), here’s the version using tags:

{% for line in line_items %}
  <p>
    {{ line.title }}  
  </p>

  {% if 'custom-made' in line.product.tags %}
    <p style="color:#d9534f; font-weight:bold;">
      You have purchased an item that is custom made. We want to make sure you have everything right, so we’ll be contacting you shortly.
    </p>
  {% endif %}
{% endfor %}

Then, just add the tag custom-made to any product in Shopify that needs this note.