Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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.
Solved! Go to the solution
This is an accepted solution.
Hi @cfry,
Please go to Theme settings > Notifications > Order Confirmation. Find 'subtotal_line_items' and add code here:
Code:
{% if line_title contains 'product title' %}
Display this message
{% endif %}
Hope it helps!
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!
This is an accepted solution.
Hi @cfry,
Please go to Theme settings > Notifications > Order Confirmation. Find 'subtotal_line_items' and add code here:
Code:
{% if line_title contains 'product title' %}
Display this message
{% endif %}
Hope it helps!
Thank you! Worked like a charm
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.
Hi @cfry,
Are you referring to the customer order page?
You can add the same code at customers/order.liquid file.
Hope it helps!
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.
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!
Thank you! Thank you! Thank you!
Hey, Can we display different images based on the products chosen?
Thank you
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?
We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024