How to limit automatic tags on product pages?

How to limit automatic tags on product pages?

RubyRoadVintage
Visitor
2 0 0

We are currently using an integration with simple consign that automatically passes tags through to shopify.

I've edited main-product.liquid to show the tags using:

 <div class="product-tags">
   {% for tag in product.tags %}
     <span class="tag">{{ tag }}</span>
   {% endfor %}
</div>

However, I would like to restrict the automatic tags other than Height, Length and width from showing. How do I do this?

Replies 2 (2)

tobebuilds
Shopify Partner
556 42 151

You can just use an `if` statement surrounding your `span.tag`.

 

{% if tag == 'Height' or tag == "Length" or tag == "width" %}
<span class="tag">{{ tag }}</span>
{% endif %}
Founder, Regios Discounts app (4.8 stars, 83 reviews, Built for Shopify)
- Custom discounts made simple
- "Just about any discount you'll ever need"
- Built by an ex-Google software engineer
- Often imitated, never duplicated
RubyRoadVintage
Visitor
2 0 0

Hi Tobe,

Thanks for responding. If I use this, it removes all the tags somehow. Where have I made an error?

<div class="product-tags">
   {% for tag in product.tags %}
     {% if tag == 'Height' or tag == "Length" or tag == "width" %}
<span class="tag">{{ tag }}</span>
{% endif %}
   {% endfor %}

 

Thank you.