Only show in stock variants in shopify filter

Topic summary

A merchant using Shopify’s Enterprise theme wants to filter products so only in-stock variants appear when customers select options like “Base.” Currently, the native Shopify filtering displays all products with that variant option regardless of availability.

Current Setup:

  • Using Enterprise theme (switching from Venture)
  • Previous filter app worked with tags and auto-tagged products based on variant stock levels

Proposed Solution:
A suggested Liquid code snippet filters the collection to show only available products:

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

Alternative Approach:
A third-party app was mentioned that specifically filters by available variants only, with a screenshot showing a “hide unavailable filter” feature.

Open Question:
The responder asked whether the Base filter uses product options or tags, which may affect the implementation approach. The issue remains unresolved pending clarification on the filter setup method.

Summarized with AI on November 1. AI used: claude-sonnet-4-5-20250929.

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.

1 Like

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.