All things Shopify and commerce
Hi
I have below code that shows list of tags on top of the page. What I want is, if product title is ''FREE BOOKS" then I don't want these tags to be shown on the top of the page. Could anyone help.
Solved! Go to the solution
This is an accepted solution.
Hey @amazezones
Please Add below code
<hr> <!-- Edit Add tags -->
{% unless product.title contains 'FREE BOOKS' %}
<div class="product_tags">
<lable>Search by Tags:</lable></br></br>
{% for tag in product.tags %}
<a class="link" href="/collections/all/{{ tag | handle }}" rel="tag" style="text-decoration: none" >
<span>{{ tag }}</span>
</a>
{% endfor %}
</div>
{% endunless %}
<hr>
Wrap it with an unless conditional
{% unless product.title == 'FREE BOOKS' %}
{% endunless %}
or
{% unless product.title contains 'FREE BOOKS' %}
{% endunless %}
or make the normal condition the else output in an if else condition
{% if product.title == 'FREE BOOKS' %}
{% else %}
{% comment %} paid books normal output {% endcomment %}
{% endunless %}
Note case sensitive, to get around that compare to a normalized title variable: {% assign normalized_title = product.title | downcase %}
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
This is an accepted solution.
Hey @amazezones
Please Add below code
<hr> <!-- Edit Add tags -->
{% unless product.title contains 'FREE BOOKS' %}
<div class="product_tags">
<lable>Search by Tags:</lable></br></br>
{% for tag in product.tags %}
<a class="link" href="/collections/all/{{ tag | handle }}" rel="tag" style="text-decoration: none" >
<span>{{ tag }}</span>
</a>
{% endfor %}
</div>
{% endunless %}
<hr>
its working, thx
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024