Enhance Your Shopify Product Pages: Adding 'Choose Option' Placeholders & Hiding Unavailable Variants
Hey everyone,
Ever landed on a product page and stared at those variant dropdowns, wishing they just said "Choose Option" instead of defaulting to the first available choice? Or maybe you've got a bunch of sold-out variants cluttering up your selections? You're definitely not alone! This is a super common frustration for Shopify store owners, and it came up recently in a really helpful community discussion.
Improving Product Page UX: The 'Choose Option' Dilemma
In a thread started by rlucca95, the core question was exactly this: how do we add those clear "Choose Option" placeholders to product dropdowns and, crucially, how do we hide those pesky unavailable variant combinations? It seems like such a basic piece of functionality, right? Yet, as many of us have experienced, getting it just right on Shopify can be a bit of a dance.
The challenge often boils down to two main goals: guiding the customer to make a selection, and decluttering the product page by hiding unavailable options to prevent frustration. While some themes offer built-in options, often, a bit more control is needed.
Navigating the App vs. Code Debate
rlucca95 initially tried an app, a "camouflage app" for hiding unavailable variants. However, it only worked in the editor and conflicted with custom code for the placeholder, bringing back sold-out variants. This is a classic scenario, as Danielkhz wisely pointed out, emphasizing that "app compatibility is usually the key factor rather than the theme itself." Custom scripts and apps often clash, overriding each other's filtering. When apps fall short or create conflicts, a direct code solution, implemented carefully, can give you the precise control you need without the overhead.
The Community-Approved Solution: Custom Liquid Magic
tim_tairli, a fantastic community expert, stepped in with a robust JavaScript snippet addressing both goals: adding the "Select option" placeholder and intelligently hiding unavailable variants. The beauty of this solution is its implementation via a "Custom liquid" block, which keeps your core theme files untouched. This is a huge win for future theme updates and troubleshooting!
Step-by-Step: Implementing the 'Choose Option' & Unavailable Variant Fix
Here's how to implement this powerful code on your Shopify store:
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 any specific product template you want to modify).
Add a 'Custom liquid' Block: In the left sidebar, under the Product information section, click + Add block. Scroll down and select Custom liquid.
Paste the Code: In the "Custom liquid" input box, paste the following JavaScript code. This code is designed to work across various themes, particularly "Horizon" family themes, but its core logic is broadly applicable.
Save Your Changes: Click Save in the top right corner.
What the Code Does (and What to Expect)
This script primarily performs two functions:
Hides Unavailable Options: The first part,
/* hide unavailable for Horizon*/, scans variant dropdowns, intelligently identifying and removing options marked as "Unavailable". If an unavailable option was pre-selected, it defaults to the first available choice.Adds 'Select option' Placeholder: The second part,
/* add "Choose option" */, inserts a "Select option" at the top of each variant dropdown, setting it as the default. It also disables the "Add to Cart" button until a valid variant combination is chosen, ensuring a complete selection before purchase.
You might see minor, harmless errors in your browser's developer console. These typically occur because the theme's built-in JavaScript might get momentarily confused by the newly added "Select option" value, but they won't break your site's functionality.
The images above show the "Select option" in action, and how unavailable options are removed, resulting in a cleaner, more intuitive user experience.
This image illustrates the harmless console errors you might see, confirming they don't impact functionality.
Final Thoughts & Best Practices
This community discussion really highlights how sometimes, even for seemingly simple UI improvements, a little custom code can go a long way. The key takeaways here are the power of the "Custom liquid" block for safely extending your theme's functionality and the importance of app compatibility when dealing with variant pickers. While some sellers might want to keep sold variants selectable for a "Notify when back" feature, for many, a clean, guided selection process is paramount. This solution gives you that control, making your product pages more intuitive and professional for your customers.
So, if you've been grappling with confusing variant dropdowns or cluttered options, give this method a try. It's a fantastic example of the Shopify community coming together to solve real-world store owner challenges!



