How can I modify the order confirmation email based on product ordered?

Solved

How can I modify the order confirmation email based on product ordered?

cfry
Shopify Partner
8 0 1

I'm trying to add a certain line of text to the order confirmation email if a certain product has been ordered.  

 

I've tried to do this:

 

{% if line_item.product.title contains 'product title' %}

Display this message

{% endif %}

 

I can't get it to work.  What am I doing wrong?  Any help would be so appreciated.  

 

Accepted Solutions (2)

LitExtension
Shopify Partner
4860 1002 1160

This is an accepted solution.

Hi @cfry,

Please go to Theme settings > Notifications > Order Confirmation. Find 'subtotal_line_items' and add code here:

Screenshot.png

Code:

{% if line_title contains 'product title' %}
  Display this message
{% endif %}

Hope it helps!

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify

View solution in original post

LitExtension
Shopify Partner
4860 1002 1160

This is an accepted solution.

Hi @cfry,

Please add code:

{% for line in subtotal_line_items %}
	{% if line.product.title %}	
        {% assign line_title = line.product.title %}	
		{% if line_title contains 'product title' %}
			Display this message
			{% break %}
		{% endif %}
    {% endif %}
{% endfor %}

Hope it helps!

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify

View solution in original post

Replies 9 (9)

LitExtension
Shopify Partner
4860 1002 1160

This is an accepted solution.

Hi @cfry,

Please go to Theme settings > Notifications > Order Confirmation. Find 'subtotal_line_items' and add code here:

Screenshot.png

Code:

{% if line_title contains 'product title' %}
  Display this message
{% endif %}

Hope it helps!

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
cfry
Shopify Partner
8 0 1

Thank you!  Worked like a charm

cfry
Shopify Partner
8 0 1

Do you know if there is a way to be able to use this logic so it calls a paragraph above the "order details" depending on the product that was sold?  Thank you so much for your help.  

LitExtension
Shopify Partner
4860 1002 1160

Hi @cfry,

Are you referring to the customer order page?

You can add the same code at customers/order.liquid file. 

Hope it helps!

 

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
cfry
Shopify Partner
8 0 1

First off - Thank you for your help!  

 

I'm trying to still add content to the body of the order confirmation email.  I've added the content to the order details area.  

 

I would like to add something at the beginning of the body of the email before the order details show.  

 

Example:

 

Thank you for your order.  Your order will be processed within 1-2 business days.  You'll receive a tracking number once it's been shipped.  

 

Then I want to create an if statement if they purchased a certain product and show it if it's in the order like we did before.  

 

Example:

Thank you for your order.  Your order will be processed within 1-2 business days.  You'll receive a tracking number once it's been shipped.  

 

{% if line_title contains 'product title' %}

Please allow 2-3 business days for this product to be shipped.  

{% endif %}

 

I just can't seem to get what we did earlier to work in the body part above order details.  

LitExtension
Shopify Partner
4860 1002 1160

This is an accepted solution.

Hi @cfry,

Please add code:

{% for line in subtotal_line_items %}
	{% if line.product.title %}	
        {% assign line_title = line.product.title %}	
		{% if line_title contains 'product title' %}
			Display this message
			{% break %}
		{% endif %}
    {% endif %}
{% endfor %}

Hope it helps!

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
cfry
Shopify Partner
8 0 1

Thank you! Thank you! Thank you!

SapnaMishra
Visitor
1 0 0

Hey, Can we display different images based on the products chosen?  

Thank you

veerajohanna
Visitor
2 0 0

Hi! I have the exact same issue and I have been using this code succesfully with my previous products and all the sudden it does not work for my new product.. any idea what could be the issue?