Problem with adding custom messages in confirmation email for specific products purchased

Problem with adding custom messages in confirmation email for specific products purchased

LianaP
Visitor
2 0 0

I am trying to our company phone number as a support line for specific products on our site but I'm having trouble getting it to show up properly. When I type in code like:

<p class="disclaimer__subtext">If you have any questions, reply to this email or contact us at <a href="mailto:{{ shop.email }}">{{ shop.email }}</a>

{% if line.product.title == ‘Lumega-Z Liquid Eye Vitamin with AREDS 2 Nutrients’ %}
or call <a href="tel:{{ shop.phone }}">{{ shop.phone }}</a>
{% endif %}</script>

{% if line.product.title == ‘GlaucoCetin Optic Nerve Cell + Eye Vitamin’ %}
or call <a href="tel:{{ shop.phone }}">{{ shop.phone }}</a>
{% endif %}</p> 



LianaP_2-1667234966927.png

 

and the result looks like this when I receive the order confirmation email after ordering only one of these products:

LianaP_1-1667234716284.png

 



I realize after the fact I could have used this code as an or statement:

{% if line.product.title == ‘Lumega-Z Liquid Eye Vitamin with AREDS 2 Nutrients’ or if line.product.title == ‘GlaucoCetin Optic Nerve Cell + Eye Vitamin’ %}
or call <a href="tel:{{ shop.phone }}">{{ shop.phone }}</a>
{% endif %}

but the fact of the matter is that it still showed up twice even if I only ordered one of the items. What's to say if I order a product that's not supposed to see the phone number won't get it as well?

 

Any help would be appreciated

 

Replies 2 (2)

gr_trading
Shopify Partner
2032 148 205

@LianaP ,

 

Comparing product title statically is not a good idea, instead you can create custom metafield and check if it's available.

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
LianaP
Visitor
2 0 0

How would I go about doing that?