How to customize confirmation emails based on product tags?

Hi! Depending on what an item is tagged as, I want the confirmation and all subsequent emails to be custom. I will only have two variants total (the original template given by Shopify and a modified version). For the modified version, I want the shop name changed and the text to show as something else.

I had seen how to add text to conditional emails by prize tag:

[% assign count = 0 %}

{% for line in subtotal_line_items %

{% for tag in line.product.tags %}

{% if tag contains “Pre-order” %}

{% if count [ 1 %}

{% assign count = count | plus: 1 %}

[span class=“order-list__item-title” style=“color:red”] Please note you have ordered a Pre-ordered item - it may take 1-2 extra weeks for processing and delivery [/span][br]

{% endif%}

{% endif%}

{% endfor%}

{% endfor%}

But I’m not sure how to replace the text entirely and change it to something else. How would I go about this?

Thanks you so much!

Hi @popchew88

Write your above code on top of the email template and check your desired code and assign true if tag found in another variable.

Now write a if and else statement for true variable and put whole email template between them.

Hoping it will work.