How can I hide default message in order confirmation email for specific product purchases?

Hi Everyone,

In my order confirmation emails, I am trying to add a line of code to hide the default message if the customer has purchased a specific product and nothing else in the order.

So far if the customer purchases they receive the default message below:

Hey{% if billing_address.first_name.size <= 1 %},{% else %}
{{ billing_address.first_name }},
{% endif %}

Thanks for shopping. We’ll email you as soon as your order has shipped.

Next, if the item in question (referred to as test) is purchased the following code is used and displays a message underneath the default message for further instructions.

{% assign count = 0 %}
{% for line in subtotal_line_items %}
{% if line.product.tags contains “test” and count < 1 %}
{% assign count = count | plus: 1 %}
Great call getting a test product. We just wanted to let you know that it’s on the way over to your inbox. Thanks for shopping!
{% else count == 1 %}
{% break %}
{% endif %}
{% endfor %}

My goal is to hide the default message if the customer only purchases the ‘test’ product. Is this possible to achieve?

Thanks for your time :slightly_smiling_face:

@Noah2021

Thanks for post

which content do you have to hide this email template?

@KetanKumar

I would like to hide the following part of my email If the customer has purchased only the “test” product and no other items.

Hey{% if billing_address.first_name.size <= 1 %},{% else %}
{{ billing_address.first_name }},
{% endif %}

Thanks for shopping. We’ll email you as soon as your order has shipped.

Does that make sense?

Is what I would like to accomplish possible?

I am guessing you cannot hide content using liquid if the customer only purchases a specific item by itself?

@Noah2021

can you please just comment if you have to hide any content like this

{% comment %}
if you have hide any content type here...
{% commentend %}

Hi @KetanKumar

Thanks for the response but that is not what I am trying to do.

I need to not display a message ONLY IF the customer has purchased a specific product by itself.

@Noah2021

thanks for it

it can be done some customization please sent personal messaage