Mastering Shopify Product Variants: How to Add 'Choose Option' Placeholders & Hide Unavailable Options
Hey fellow store owners!
Ever found yourself staring at your Shopify product pages, wishing those variant dropdowns had a friendly little "Choose Option" prompt instead of defaulting to the first available choice? Or perhaps you've been frustrated by customers trying to select options that are clearly out of stock?
You're definitely not alone. This is a common pain point, and it recently sparked a fantastic discussion in the Shopify community that I wanted to share with you all. It highlights a recurring theme: sometimes, getting what seems like basic functionality requires a bit of clever customization, even if it feels like Shopify "should" have it built-in. Let's dive into how one of our community experts helped a store owner tackle this head-on.
The Variant Picker Conundrum: Placeholders & Hidden Options
Our story starts with rlucca95, a store owner who, like many of us, wanted two key things for their product variant dropdowns:
- "Choose Option" Placeholders: When a customer first lands on a product page, rlucca95 wanted the dropdowns to clearly prompt them to make a selection, rather than pre-selecting a variant. This is a subtle but powerful UX improvement, guiding customers more intuitively.
- Hide Unavailable Variants: No one likes clicking on something only to find it's out of stock. The goal was to remove unavailable or sold-out combinations from the dropdowns entirely, streamlining the selection process and preventing frustration.
rlucca95 initially tried using an app (the "Camouflage app") for hiding unavailable variants, but ran into a classic Shopify challenge: app conflicts. The app wasn't working on the live site, and custom code for placeholders was clashing with it. As rlucca95 put it, it felt like "so much code and mucking around for what seems like such a basic functionality that Shopify SHOULD have." And honestly, many of us have felt that way!
Why Isn't This Standard? A Peek Behind the Curtain
Why isn't this functionality always baked into every theme? As our expert tim_tairli pointed out, it's an "old point of disagreement." Some themes do have options to hide unavailable variants. But there's a flip side: some sellers actually want customers to see sold-out variants so they can offer "Notify when back" functionality. It's a design choice with different implications for different businesses. This often means that a one-size-fits-all solution isn't always feasible from Shopify's core platform, leaving room for customization.
Danielkhz also chimed in, echoing the sentiment about conflicts between custom scripts and apps. "App compatibility is usually the key factor rather than the theme itself," they noted, which is a crucial insight for anyone dealing with complex customizations.
The Community-Powered Solution: Custom Liquid to the Rescue!
Thankfully, tim_tairli stepped up with an elegant, code-based solution that addressed both of rlucca95's goals without relying on a potentially conflicting app or directly editing theme files. The beauty of this approach lies in using a "Custom Liquid" block – a Shopify feature that lets you inject code without touching your theme's core files, making updates and troubleshooting much easier.
Here’s how tim_tairli explained it:
- You keep your theme code untouched (a huge win for theme updates and troubleshooting).
- It's easy to turn on/off.
- It can even be applied to specific product page templates if needed.
rlucca95 tested it out and confirmed, "Mate that worked predy well perfectly! Thank you so much." Success!
Step-by-Step: Implementing the "Choose Option" Placeholder & Hiding Unavailable Variants
Ready to implement this on your store? Here are the steps, based on tim_tairli's guidance:
- Access Your Theme Editor: From your Shopify admin, go to Online Store > Themes. Find your current theme and click Customize.
- Navigate to a Product Page: In the theme editor, use the dropdown at the top to select Products > Default product (or whichever product template you want to apply this to).
- Add a "Custom Liquid" Block: In the left sidebar, under the Product information section, click + Add block. Search for and select Custom liquid.
- Paste the Combined Code: Now, copy the following JavaScript code provided by tim_tairli and paste it into the "Custom liquid" block's content area. This script does two things: it hides unavailable options and adds the "Select option" placeholder.
This code targets the variant dropdowns (.product-information variant-picker select) and dynamically adds a "Select option" at the beginning, ensuring it's the default. It also disables the "Add to Cart" button until a valid variant is chosen. The first part of the script actively looks for and removes options marked as "- Unavailable" (or its localized equivalent), cleaning up your dropdowns.
Here’s what you can expect the dropdowns to look like:
And here's where you'd place the "Custom liquid" block in your theme editor:
You might notice some errors in your browser's console after adding this code, as tim_tairli warned:
Don't worry about these! They happen because your theme's default JavaScript gets a little confused by the newly injected "Select option" placeholder. But as tim_tairli confirmed, this "would not break anything" critical on your site.
Wrapping It Up: Empowering Your Store with Smarter Variants
This whole discussion really underscores the power of the Shopify community and the flexibility of the platform, even when it requires a little elbow grease. While we might wish for every little UI detail to be a toggle in the admin, understanding how to use tools like "Custom liquid" blocks can unlock a world of possibilities for customizing your store exactly how you envision it. It's about taking control and making your product pages as intuitive and user-friendly as possible. Big thanks to tim_tairli for sharing such a robust and helpful solution!



