Enhance Shopify UX: Visually Mark Out-of-Stock Variants on Product Pages
Hey there, fellow store owners! Let's talk about something super common that can make or break a customer's experience on your product pages: clearly showing what's in stock and what's not. We recently saw a fantastic discussion pop up in the Shopify Community, started by kinddogshop, a store owner running a charming dog-themed shop with their Retina theme. Their challenge? When customers clicked through different sizes and colors of a sweater, it was hard to tell which combinations were actually available. Sound familiar?
This isn't just a minor detail; it's a crucial part of user experience. Imagine a customer falling in love with a product, only to click through variants and realize their preferred size and color isn't available, with no clear visual cue. Frustrating, right? That's exactly what kinddogshop was trying to fix, and the community rallied with some excellent solutions. At Shopping Cart Mover, we understand that every detail contributes to a seamless shopping journey and ultimately, higher conversions. Let's dive into how you can solve this for your own store, drawing on the wisdom shared by our peers.
Start with the Basics: Your Theme Settings
Before you even think about code, the first place to check, as Maximus3 wisely pointed out in the thread, is your theme settings. Many modern Shopify themes offer built-in options for how out-of-stock variants are handled. You'll usually find these under your theme customizer, likely in a "Product" or "Product Pages" section.
kinddogshop confirmed that for their Retina theme, the "Hide sold-out variants" option was already set to "Disabled" (which is what you want if you wish to show the variants but visually mark them as unavailable). This is a great starting point, as it ensures all options are visible, even if out of stock. If your theme has a similar setting, make sure it's configured to not hide sold-out variants if your goal is to grey them out or strike them through. If you hide them, customers won't even know that particular variant ever existed, which can also be a missed opportunity for future stock notifications.
The Code-Savvy Approach: Custom CSS for Visual Cues
For those comfortable with a little bit of code, CSS offers powerful and flexible ways to visually communicate variant availability. The Shopify Community provided excellent snippets that leverage modern CSS selectors.
Method 1: Greying Out Unavailable Variants (Opacity)
The simplest and most common visual cue is to reduce the opacity of out-of-stock options, making them appear greyed out. This was the initial solution that Moeed and tim_1 provided, and it's incredibly effective.
The core idea is to target the HTML element that represents your variant option (often a `label` or a `button`) and apply an `opacity` style when it contains an input field with the `data-variant-option-available="false"` attribute. This attribute is a standard way Shopify themes mark unavailable variants.
Where to Add This CSS:
- Theme Customizer's Custom CSS: Most Shopify themes have a dedicated "Custom CSS" field within the theme editor (Online Store > Themes > Customize > Theme settings or a specific section). This is the cleanest place for simple CSS additions.
- `theme.liquid` file: For broader compatibility or if your theme lacks a Custom CSS field, you can add it directly to your `theme.liquid` file. Navigate to Online Store > Themes > Actions > Edit Code. Find `theme.liquid` and paste the code just above the `