Hide tag filters in specific collection?

artoko
New Member
21 0 0

I am using tags to filter my products in the collection pages.

E.g in 'Shop Shorts' tags are being used to filter products by size and in 'Jewellery' tags are filtering by product type (necklaces, bracelets etc).

Then I have a collection called 'What's New', this may include products that are in both 'Shop Shorts' and 'Jewellery', but that's when the tags are going to get messy.

So I was wondering if there is a way to hide the tag filters in this specific collection, whilst keeping them active in the others?

Any help would be hugely appreciated!

 

<ul class="subnav clearfix">
  <li class="size-all{% unless current_tags %} active{% endunless %}">
    {% if collection.handle %}
    {% comment %}Good for /collections/all collection and regular collections{% endcomment %}
    <a href="/collections/{{ collection.handle }}">All</a>
    {% comment %}Good for automatic type collections{% endcomment %}
    {% elsif collection.products.first.type == collection.title %}
    <a href="{{ collection.title | url_for_type }}">All</a>
    {% comment %}Good for automatic vendor collections{% endcomment %}
    {% elsif collection.products.first.vendor == collection.title %}
    <a href="{{ collection.title | url_for_vendor }}">All</a>
    {% endif %}
  </li> 
  {% for tag in collection.all_tags %}
  {% if current_tags contains tag %}
<li class="active size-{{tag}}">
    {{ tag | link_to_remove_tag: tag }}
  </li>
  {% else %}
  <li class="size-{{tag}}">
    {{ tag | link_to_tag: tag }}
  </li>
  {% endif %}
  {% endfor %}  
</ul>

 

 

 

Replies 3 (3)
parkersweb
Shopify Partner
15 0 2

Hey Artoko,

I think (if I've understood what you're asking correctly) that's easy enough.  Create a new template called collection.whats-new.liquid which is a copy of your current collection.liquid.

Edit that template to remove the 'filter by tag' code, and save.  Once you'd done that just click open that collection in the admin screen; below the description and product selection section there's an option to choose your template if you select the one you've just created you should be good :-)

Andrew

artoko
New Member
21 0 0

Hey Andrew!

Brilliant, it worked perfectly! Thanks so much for your time :)

 

Sandra26
New Member
1 0 0

Hi.... a very old discussion but maybe someone can help. I also use a day filter on the collections pages. My wish would be to keep the filter hidden when the page is loaded. A click on a button (filter on / off) should display the filter section, with a further click it should disappear again. Can someone help?