How to Hide Unavailable Tags From Collection Filters? I NEED A SUPERHERO!

Hey there,

I’m using a third-party theme, and the theme has tag filtering feature in the collection page which is great. But the problem is: it doesn’t hide unavailable tags and shows all the tags that I put in on every collection whether they are available or not. I found this ‘‘sidebar-tag-filter.liquid’’ in the ‘‘Sections’’ and I tried to fix it by myself but I couldn’t.

I would appreciate it a lot if someone could help me with that.

Here is the code:

{% if section.blocks.size > 0 %}   
{% for block in section.blocks %}      
      {% if  block.settings.enable_shop_by_tags %}
      {% if  block.settings.shop_by_tags_title != blank %}
        
        {% assign tags = block.settings.shop_by_tags_list | split: ',' %}
        

          #### 
            {{ block.settings.shop_by_tags_title  }} 
            
            
            
          
        
        
          

             {% assign counter = 0 %}
            {% for t in tags %}
            {% assign tag = t | strip %}
            {% assign tag_value = tag | handleize %}      
            {% if current_tags contains tag %}
            - 

            {% else %}          
            - 

             {% assign counter = counter | plus:1 %}            
            {% endif %}
            {% endfor %}
            {% if counter == 0 %}{% endif %}
          

        

          

      
      {% endif %}
      {% endif %}
{% endfor %}
{% endif %}
  
  
{% schema %}
  
  {
    "name": "Tags",
    "max_blocks": 20,
    "settings": [
	  {
        "type": "checkbox",
        "id": "enable_sidebar_multiple_choice",
        "label": "Multiple choices",
        "default": true,
        "info": "User can select multiple colors (size, brand...) or only one color (size, brand...)?"
      }     
],
"blocks": [   
 	{
        "type": "text",
        "name": "Tags",
 		"settings": [
        {     
      
        "type": "checkbox",
        "id": "enable_shop_by_tags",
        "label": "Enable",
        "default": true
      },
      {
        "type": "text",
        "id": "shop_by_tags_title",
        "label": "Shop by tags",
        "default": "Shop By Size",
        "info": "i.e \"Shop by Size\"."
      },
     {
        "type": "textarea",
        "id": "shop_by_tags_list",
        "label": "Tags list",
        "info": "Separate by a comma, i.e \"XS, S, M, L, XL\"."
      }
]
}
]
  }
{% endschema %}

Hello, @TimmyTips

Welcome to the Shopify community!
and Thanks for your Good question.

Please share your site URL,
So I will check and provide a solution here.

Hey @KetanKumar ,

Thank you so much for reaching out! Here is my website: buytilestone.com

@TimmyTips

Thanks for store url

if possible to let me know which one did you hide?

Thank you @KetanKumar . I didn’t hide anything. I want the unavailable tags to be hidden.

For example, let’s take a look at ‘‘Shop By Finish’’ filter: We don’t have any ‘‘Polished’’ or ‘‘Honed’’ finished product in Pavers collection. So, I don’t want these tags to be seen in Pavers. But every tag that I put in is seen in every collection whether they are available or not. That’s the problem.

@TimmyTips

Thanks

ok do you need if the product sold out doesn’t show filter right? if yes so i can be done some customization take more time

@KetanKumar

No. I need something like: “if the tag filter is not applicable to the collection, don’t show the tag filter”

@TimmyTips

Ok

Thanks for clearing maybe some custom code and testing on the backend side

Exactly @KetanKumar ! That’s what I need. Could you help me with that?

@TimmyTips

Thanks for update can you please send me PM

I am looking for the same fix. Did you find a solution? @KetanKumar

@Logan102
oh sorry for that issue can you please share store url so i will check and let you know

I am looking for the same fix. Can you help me? @KetanKumar