Only show in stock variants in shopify filter

Only show in stock variants in shopify filter

oinkpigments
Tourist
4 0 5

Currently setting up Enterprise theme for our shop and would like to use the Shopify filtering, but when I pick Base as a filter option, it shows every item that has that base regardless of if it's in stock. Is there a way to make it show only the ones that are actually available? Our current filter app lets us use tags, and we have a separate app that automatically tags products when their variants have stock.

 

store is https://oinkpigments.com/ currently on Venture theme, but switching to Enterprise.

Reply 1 (1)

Nancy_Drake
Shopify Partner
206 11 21

Hi @oinkpigments 

 

You can add these liquid codes 

 

You can try using this code

 

{% assign available_products = collection.products %}

{% for filter in collection.filters %}
{% if filter.active_values.size %}

{% assign available_products = collection.products | where: 'available' %}

{% endif %}

{% endfor %}

{% for product in available_products -%}
[render code]
{%- endfor %}

 

Do you create the Base filter using a product option or tags? If you're open to using a third-party solution, our app allows filtering by available variants only, ensuring that customers only see in-stock items when they apply filters.

hide-unavailable-filter.png

AI Search & Product Filter | SB - Check out our Shopify search and filter app to drive more sales