I just switched to the Horizon theme and am wanting to hide variants that are not used/do not exist. These are not sold out- they just do not exist on the backend.
For example, in the screenshot below the 14 mm only come in 2 styles. The other styles have been removed from the product, but they still show as if they are sold out. How can i hide these without hiding sold out variants on other variant combinations?
**NOTE: I do NOT want to use an app! Please do not suggest an app.
Basically it will remove all crossed out buttons on your screenshot.
The code will hide all unavailable variant selection buttons – both for sold-out and for non-existing combinations.
Current theme code does not make distinction between those and the only reason to want sold-out options combinations to show is to allow for “back in stock” notifications apps.
If you do not have those, then code above should work, otherwise it would require theme code modification, which is possible, but would make your future theme updates problematic.
if my post is helpful, please like it via ♡ button and mark as a solution -- this will help others find it
this also hides sold out variant options, not just the variant options that do not exist on the backend. I want sold out variants to show so customers know we carry them.
This hides any label whose input is unavailable AND has no data-variant-id meaning the combination doesn’t exist at all while leaving sold-out options (which do have a data-variant-id) visible with their strikethrough.