I tried at first to use the code as presented in this post, but I had to also assign tag_value to get it to work. The important bits are:
{% assign tag_value = value.value %}
{% unless tag_value contains ‘_’ %}
Add those two pieces after both instances of “{%- for value in filter.values -%}” inside the section.
Here’s the section of code I changed in facets.liquid, with the additions shown in blue. The bits between are just notes to document what the additions are doing; those won’t show in the generated page and don’t affect function, they’re purely informational.
{{ filter.label | escape }}-
{%- for value in filter.values -%}
-
<svg
width=“1.6rem”
height=“1.6rem”
viewBox=“0 0 16 16”
aria-hidden=“true”
focusable=“false”
<svg
aria-hidden=“true”
class=“icon icon-checkmark”
width=“1.1rem”
height=“0.7rem”
viewBox=“0 0 11 7”
fill=“none”
xmlns=“http://www.w3.org/2000/svg”
{{ value.label | escape }} ({{ value.count }})
{{- value.label | escape }} (
{%- if value.count == 1 -%}
{{- ‘products.facets.product_count_simple.one’ | t: count: value.count -}}
{%- else -%}
{{- ‘products.facets.product_count_simple.other’ | t: count: value.count -}}
{%- endif -%}
)</span
{% endunless %}
{%- endfor -%}
{% assign tag_value = value.value %}
{% unless tag_value contains ‘_’ %}
-
{%- for value in filter.values -%}
-
<svg
width=“1.6rem”
height=“1.6rem”
viewBox=“0 0 16 16”
aria-hidden=“true”
focusable=“false”
<svg
aria-hidden=“true”
class=“icon icon-checkmark”
width=“1.1rem”
height=“0.7rem”
viewBox=“0 0 11 7”
fill=“none”
xmlns=“http://www.w3.org/2000/svg”
{{ value.label | escape }} ({{ value.count }})
{{- value.label | escape }} (
{%- if value.count == 1 -%}
{{- ‘products.facets.product_count_simple.one’ | t: count: value.count -}}
{%- else -%}
{{- ‘products.facets.product_count_simple.other’ | t: count: value.count -}}
{%- endif -%}
)</span
{% endunless %}
{%- endfor -%}
{% assign tag_value = value.value %}
{% unless tag_value contains ‘_’ %}