Declutter Your Shopify Product Pages: How to Hide Out-of-Stock Variants in the Horizon Theme
Hey fellow store owners!
Ever landed on a product page only to be met with a sea of crossed-out colors or sizes, making it feel like everything you want is perpetually unavailable? It's a common frustration, and it's something many of us want to fix on our own Shopify stores. Recently, our community had a fantastic discussion about this very issue, specifically for those of you rocking the Horizon theme.
The original question came from Hervé, a store owner from Paris, who perfectly summed up the problem: his Horizon theme was showing out-of-stock variants as crossed out, but still visible in the selector. He wanted to completely hide them, leaving only the truly available options for a cleaner, less "deceptive" customer experience, especially with products that have a "many many variantes of colors not available" matrix. And honestly, who can blame him? A cluttered product page can really impact a customer's journey.
Why a Clean Product Page Matters
As Hervé pointed out, seeing a bunch of unavailable options can be a bit of a turn-off. It can make a customer feel like they're constantly hitting dead ends, leading to frustration and potentially, them leaving your site. For stores with extensive product lines and numerous variants, minimizing this visual noise is crucial for a smooth shopping experience. A clean selector means customers can quickly see what's actually in stock and make a purchasing decision without unnecessary distractions.
The Community Solution: Hiding Out-of-Stock Variants
While the Horizon theme, like many others, doesn't have a built-in toggle for this, our amazing community quickly jumped in with a solid, code-based solution. Ecom_swift_LLC confirmed that a code change or an app would be necessary, but it was Ploqo who delivered the goods with a super actionable CSS snippet and clear instructions. Hervé tried it out and reported back that it "works perfectly" and would make his "minimalist store style better now." That's the power of community right there!
Step-by-Step: How to Hide Swatch-Style Variants
This method involves adding a small piece of CSS directly into your theme using a Custom Liquid block. It's relatively straightforward, but remember, it's always a good idea to duplicate your theme before making any code changes, just in case!
- Open the Theme Editor:
- From your Shopify admin, go to Online Store > Themes.
- Find your Horizon theme and click Customize.
- Navigate to a product page in the editor.
- Add a Custom Liquid Block:
- In the left-hand panel, under Product information > Details, click Add block.
- Search for "liquid" and select Custom Liquid.

- Paste the CSS Code:
- In the "Custom Liquid" box that appears, paste the following code:

- Save Your Changes:
- Click Save in the top right corner.
Here's a visual of the transformation:
Before: The out-of-stock colours are crossed out but still shown

After: The out-of-stock colours are hidden

What About Dropdown-Style Pickers?
Ecom_swift_LLC brought up another excellent point: if some of your products use dropdowns instead of swatches, the initial CSS snippet won't quite catch those. For dropdown-style variant selectors, you'll want to add this additional rule:
You can combine this with the previous snippet within the same tags. This ensures a consistent experience across all your product pages, regardless of the picker style.
Important Considerations and Best Practices
While this CSS solution is super effective for a cleaner look, there are a few expert insights from the thread that you should definitely keep in mind:
- Browser Compatibility: The
:has()pseudo-class, which makes this snippet so powerful, requires reasonably modern browsers (Chrome 105+, Safari 15.4+). On older browsers, the rule simply won't apply, and your out-of-stock variants will revert to being crossed out. Nothing breaks, it just won't be hidden for those users. - Presentation Only: Remember, this is a visual change using CSS. The variant still exists in your product JSON and structured data. If a color or size is permanently discontinued (not just temporarily out of stock), it's much better to delete it from the product settings in your Shopify admin. Otherwise, search engines and apps reading your variant data might still surface it, leading to potential confusion.
- Direct Links: Ecom_swift_LLC wisely noted that if someone lands on a direct link to a sold-out variant, Horizon might still preselect it. It's a good idea to test a few of these URLs after implementing the change to ensure the experience is as expected.
- The "Signal" Debate: This is a big one! While hiding out-of-stock variants creates a cleaner page, some merchants find that the crossed-out state actually converts better. Why? Because it signals that the product does exist in that option, prompting customers to check back later or consider a similar available option. Hiding it completely might make customers assume you never carried it. For variants that frequently go out of stock but are restocked, consider a "notify me when available" app – it often earns more than simply hiding the variant.
- Hiding Entire Option Groups: Hervé also brought up a more advanced point: what if all colors for a specific size are out of stock? Can we hide the "size" button itself? This is a really good question and points to a more complex customization. The provided CSS hides individual options (like a single color swatch), but dynamically hiding an entire parent option group (like a size button) when all its dependent options are unavailable would likely require more intricate Liquid logic or a specialized app. It's a fantastic idea for an even cleaner experience, but goes beyond a simple CSS tweak.
Ultimately, whether you decide to hide or show crossed-out variants depends on your specific store, product type, and customer base. But for those like Hervé who prioritize a minimalist, clutter-free product page, this community-driven solution offers a fantastic way to achieve it. It's a great example of how a little code, shared by helpful experts, can significantly enhance your Shopify store's user experience. And if you're looking to start your own journey with an amazing platform like Shopify, remember there's a huge community ready to help you every step of the way!