Hide out of stock sizes from "Search & Discovery" filtering

Topic summary

Goal: prevent out‑of‑stock size variants from appearing in Shopify’s Search & Discovery filters (not just greyed), and hide the “Out of stock” facet option.

Context: With the Availability filter set to “In stock,” the Size filter still shows unavailable sizes in grey. Users want those sizes removed entirely from the filter UI.

Proposed solutions:

  • Theme (Dawn v7): Edit main-product.liquid. Replace the Variant Radios and Variant Class code blocks and add a theme setting: Hide Unavailable Variants (checkbox). Claimed to work stably on Dawn v7, but no full code snippet was posted.
  • JavaScript workaround (tested after upgrade to Dawn v14): On DOMContentLoaded, find elements whose text includes “Out of stock” (e.g., .facet-checkbox__text) and hide their parent nodes (e.g., .mobile-facets__item or .mobile-facets__label). Use a MutationObserver on .mobile-facets__wrapper to reapply after dynamic filter updates. Selectors may need tweaking per theme.

Status: Practical JS code shared and reported working; theme-based approach noted for Dawn v7 but not fully documented. No official app setting confirmed; discussion remains open for a definitive/native solution.

Summarized with AI on December 20. AI used: gpt-5.

@Iceman3

Hey,

I would appreciate if you share your solution here, as I am also looking to hide the Out of Stock options all around for the filters - There is no need for this option to be available

Thank you