Availability filter

I have a question, in the availability filter when a product with variants has one variant out of stock and the others are in stock, the filter shows it as out of stock.

How do I validate that if all the variants are sold out, it will just show as sold out.

{%- for value in filter.values -%}

  • {{ value.label | escape }} ({{ value.count }})
  • {%- endfor -%}