Hi,
I’m trying to hide any tags starting with an underscore ‘_’ or even containing an underscore from showing up in the filter on the collection pages. I am using the Search and Discovery filter and have found the .liquid page to amend the code, but everything I have tried has not worked.
I’m trying to utilize the code which I found on this post: https://community.shopify.com/topic/1249683
The collection filter liquid template contains the following:
{%- assign has_current_filters = false -%}
{%- assign type = type | default: '1' -%}
{%- assign active_filter_groups_size = 0 -%}
{%- if type == '1' and block.settings.show_group -%}
{%- for filter in collection.filters -%}
{%- if type == '1' and block.settings.show_group and filter.type == 'list' and filter.active_values.size > 0 -%}
{%- assign active_filter_groups_size = active_filter_groups_size | plus: 1 -%}
{%- endif -%}
{%- if type == '1' and block.settings.show_group and filter.type == 'price_range' and filter.min_value.value != nil or filter.max_value.value != nil -%}
{%- assign active_filter_groups_size = active_filter_groups_size | plus: 1 -%}
{%- endif -%}
{%- endfor -%}
{%- if current_tags.size > 0 -%}
{%- assign active_filter_groups_size = active_filter_groups_size | plus: 1 -%}
{%- endif -%}
{%- endif -%}
{%- for filter in collection.filters -%}
{%- if filter.type == 'list' and active_filter_groups_size > 1 and filter.active_values.size > 0 -%}
{%- endif -%}
{%- if filter.type == 'price_range' and active_filter_groups_size > 1 and filter.min_value.value != nil or filter.max_value.value != nil -%}
{%- endif -%}
{%- for value in filter.active_values -%}
{%- assign has_current_filters = true -%}
{%- endfor -%}
{%- if filter.type == 'price_range' -%}
{%- if filter.min_value.value != nil or filter.max_value.value != nil -%}
{%- assign has_current_filters = true -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if current_tags.size > 0 -%}
{%- if active_filter_groups_size > 1 -%}
{%- endif -%}
{%- for tag in current_tags -%}
{%- assign to_tag_url = tag | link_to_remove_tag: tag | split: 'href="' | last | split: '"' | first -%}
{%- assign has_current_filters = true -%}
{%- endfor -%}
{%- endif -%}
{%- assign hide_section = true -%}
{%- if has_current_filters -%}
{%- assign hide_section = false -%}
{%- endif -%}
Any help would be appreciated,
Kind regards,
jdb