"If" based on customer tags

Solved
New Member
4 0 0

Hi,

 

Certain products we sell are visible to all customers but only purchasable by our dealers. We have a different product template which achieves this. The following code in the altered product template was previously working but is not working any more and I am at a loss as to why.

 

{% if customer.tags contains 'Dealer' or 'dealer' %}
{%else%}
<span class=""> This product can only be purchased through a <a href="https://ecoinnovation.myshopify.com/pages/find-a-dealer">dealer</a>. if you are a dealer please <a href="https://ecoinnovation.myshopify.com/account/login">log in</a>
<span class="" ></span>
{%endif%}

 

Any thoughts on possible causes are much appreciated.

 

0 Likes
Shopify Partner
1137 91 138

please share a store url

Thanks & Regards
Perennial Solution

Problem Solved?✔️Like and Accept the solution that can help others.
Need any help with theme customization or design? Hire us
Email: infoperennialsolution@gmail.com
Skype: infoperennialsolution
0 Likes

Success.

Shopify Expert
2660 63 662

Mate, this code is wrong:

{% if customer.tags contains 'Dealer' or 'dealer' %}

it should be like:

{% if customer.tags contains 'Dealer' or customer.tags contains 'dealer' %}

(I'd guess that it always shows the warning, since "dealer" is evaluated to true for  the purposes of the if  tag. And it was working before someone added the second condition?)

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
0 Likes
New Member
4 0 0
Thank you so much for taking the time to help me learn. I really appreciate it.
0 Likes