Shopify Size Filters Showing Out-of-Stock? A Deep Dive & Fix for Impulse Theme Owners

Hey fellow store owners! Let's talk about something that can be a real head-scratcher and, frankly, a bit frustrating for both you and your customers: those pesky size filters that just won't hide out-of-stock items. We've all been there, right? A customer filters for a 'Large' t-shirt, and your collection page still shows a product that's completely sold out in that size. It's not the best experience, and it's a common pain point, especially for those of you rocking popular themes like Impulse.

Recently, a store owner, Kralc_Bocaj, brought this exact issue to the Shopify community forums, specifically asking about the Impulse theme and the Shopify Search & Discovery app. He wasn't comfortable with code edits and wanted to know if there was a simple setting or workaround. The discussion that followed was super insightful, and I wanted to break down what we learned for everyone.

Understanding the "Why": Shopify's Native Filtering Logic

First off, let's clear up a common misconception: this isn't an Impulse theme bug, nor is it a setting you've missed. As Ajay from Pinflow and Tim Tairli, both active community members, pointed out, this is actually how Shopify's native storefront filtering – including the Search & Discovery app – is designed to work. And it's a bit counter-intuitive.

  • A size filter in Shopify matches any product that has that size as an option, regardless of whether that specific size is currently in stock.
  • The only stock-aware filter, "Availability," works at the product level. This means if even just one variant of a product is in stock, the entire product is considered "available." So, filtering for "Medium" + "In stock" still won't guarantee that the "Medium" variant itself is available. It just means *some* variant of that product is available.

No theme setting or Search & Discovery toggle can change this core behavior directly. So, what are your options?

Solution Path 1: The Robust App Approach (Reliable but Paid)

One of the most reliable ways to get true variant-level filtering is to use a dedicated third-party search and filter app. Ajay mentioned apps like Boost AI Search & Filter or Globo Smart Product Filter. These apps are built to index your products at the variant level, giving you much finer control.

Here's why this route is often recommended:

  • True Variant Filtering: They can genuinely hide products if a specific filtered size is out of stock across all variants.
  • Accurate Counts & Pagination: Crucially, these apps will correctly update your "N products" count and pagination, reflecting only the truly available items.
  • Advanced Features: Many offer other powerful search and filtering capabilities that can significantly enhance your customer experience.

Moeed, another expert in the thread, did caution that filter apps "are really messy," which can be true if you pick the wrong one or don't configure it properly. However, for a robust, long-term solution that maintains data integrity, a well-chosen app is often the way to go. If you're just starting your Shopify journey and looking for a platform that offers this kind of flexibility, remember that Shopify itself is constantly evolving with a rich app ecosystem to help you customize your store.

Solution Path 2: The Custom Code Tweak (Free but Tricky)

For those who prefer a more DIY approach and want to avoid app subscriptions, Ajay shared a clever Liquid code solution. This code snippet works by intercepting the products in your collection loop and *conditionally hiding* them if the active size filter doesn't have an available variant. It's important to note the caveat Ajay pointed out: "the 'N products' count won't update. Pagination won't either. Only the cards hide." This means your customers might see "Showing 1-12 of 30 products" even if only 5 are actually displayed after the filter, which isn't ideal but might be acceptable for some.

How to Implement Ajay's Code Fix:

This fix is for the 'Size' filter specifically, but Ajay mentioned it can be extended for other filters if you're comfortable with code.

  1. Access Your Theme Code: Go to your Shopify Admin > Online Store > Themes. Find your current theme, click "Actions" > "Edit code."
  2. Locate the File: Navigate to sections/collection-template.liquid.
  3. Insert the Code: You'll need to add this code snippet inside the product loop, specifically right before the product card renders. The exact location can vary slightly depending on your theme's structure, but look for where individual product cards are being generated.

Here's the code from Ajay:

{%- assign size_opti -%}
{%- assign size_param = 'filter.v.option.' | append: size_option_name | handleize -%}

{%- assign active_sizes = '' -%}
{%- for f in collection.filters -%}
  {%- if f.param_name == size_param -%}
    {%- for v in f.active_values -%}
      {%- assign active_sizes = active_sizes | append: '|' | append: v.value | append: '|' -%}
    {%- endfor -%}
  {%- endif -%}
{%- endfor -%}

{%- if active_sizes != '' -%}
  {%- assign size_pos = 0 -%}
  {%- for opt in product.options_with_values -%}
    {%- if opt.name == size_option_name -%}{%- assign size_pos = opt.position -%}{%- endif -%}
  {%- endfor -%}

  {%- if size_pos > 0 -%}
    {%- assign match_in_stock = false -%}
    {%- for v in product.variants -%}
      {%- if v.available -%}
        {%- assign vsize = '' -%}
        {%- if size_pos == 1 -%}{%- assign vsize = v.option1 -%}
        {%- elsif size_pos == 2 -%}{%- assign vsize = v.option2 -%}
        {%- elsif size_pos == 3 -%}{%- assign vsize = v.option3 -%}{%- endif -%}
        {%- assign needle = '|' | append: vsize | append: '|' -%}
        {%- if active_sizes contains needle -%}{%- assign match_in_stock = true -%}{%- endif -%}
      {%- endif -%}
    {%- endfor -%}

    {%- unless match_in_stock -%}{%- continue -%}{%- endunless -%}
  {%- endif -%}
{%- endif -%}

Here's a visual of the impact:

Buggy one - without this fix applied:


After applying the fix - SEE THE THIRD ONE IS OUT OF THE LIST:

Since Kralc_Bocaj mentioned not being comfortable with code, this is definitely a job for a developer or a Shopify Partner if you choose this route. Always back up your theme before making any code changes!

Making Your Choice

So, there you have it. You've got a couple of solid paths to tackle the "out-of-stock size" filtering issue on your Shopify store, whether you're on Impulse or another theme. The choice really boils down to your budget, your comfort with code, and how critical accurate product counts and pagination are for your customer experience.

If you need a bulletproof solution that keeps everything perfectly aligned, a dedicated filtering app is probably your best bet. If you're looking for a free, quick fix and can live with the pagination quirk, Ajay's code is a fantastic option, especially with the help of a skilled developer. Ultimately, optimizing your filters is about making it easier for customers to find exactly what they're looking for, which always leads to a better shopping experience and, hopefully, more sales for you!

Share:

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools