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

Highlighted
Tourist
5 0 5

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 %}
      <aside class="sidebar-tag filter tags {{ block.settings.shop_by_tags_title | downcase }} {{forloop.index}}">  
        {% assign tags = block.settings.shop_by_tags_list | split: ',' %}
        <div class="widget">
          <h4>
            <span>{{ block.settings.shop_by_tags_title  }} </span>
            <a href="javascript&colon;void(0)" class="clear" style="display:none">
            <i class="zmdi zmdi-close"></i>
            </a>
          </h4>
        
        <div class="widget-content">
          <ul>
             {% assign counter = 0 %}
            {% for t in tags %}
            {% assign tag = t | strip %}
            {% assign tag_value = tag | handleize %}      
            {% if current_tags contains tag %}
            <li>
              <i></i>
              <input type="checkbox" value="{{ tag_value }}" checked/>
              <label>{{ tag  }}</label>
            </li>
            {% else %}          
            <li>
               <i></i>
              <input type="checkbox" value="{{ tag_value }}"/>
              <label>{{ tag }}</label>
            </li>
             {% assign counter = counter | plus:1 %}            
            {% endif %}
            {% endfor %}
            {% if counter == 0 %}<script>$('.sidebar-tag.{{forloop.index}}').hide();</script>{% endif %}
          </ul>
        </div>
          </div>
      </aside>
      {% 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 %}

 

 

 

1 Like
Highlighted
Shopify Partner
7473 1034 2599

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.

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
1 Like
Highlighted
Tourist
5 0 5

Hey @KetanKumar,

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

1 Like
Highlighted
Shopify Partner
7473 1034 2599

@TimmyTips 

Thanks for store url

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

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
1 Like
Highlighted
Tourist
5 0 5

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.

1 Like
Highlighted
Shopify Partner
7473 1034 2599

@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

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
1 Like
Highlighted
Tourist
5 0 5

@KetanKumar

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

1 Like
Highlighted
Shopify Partner
7473 1034 2599

@TimmyTips 

Ok

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

 

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
1 Like
Highlighted
Tourist
5 0 5

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

1 Like
Highlighted
Shopify Partner
7473 1034 2599

@TimmyTips 

Thanks for update can you please send me PM

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
0 Likes