How can I remove unavailable variants on listings?

New Member
1 0 0

Hey guys,

I'm having a few issues trying to find the answer to this.

What i'm trying to acheive is to remove the unavailable variants in a product drop down menu.
I've got some items that are on the same listing but are available in different colours.
What is happening is that the colours that are unavailable for item X is still an option in the drop down menu, even though i've deleted the variant in the product creation area. So when the variant is selected it will display the message Item unavailable.

I've followed this link which got rid of the unavailable varients successfully

Though when a current variant becomes sold out, it gets removed as well from the drop down menu so you can't select the sold out variant. I'd like it to still have the option to select it and say sold out on the button where add to cart is, not to be removed completely. 

Greatly Appreciated. 

Replies 4 (4)
1889 2 472

In the snippet that you created from the tutorial, you should have the following line of code (around Line 53).

    if (variant.available) {

Try changing that line to:

    if (variant) {


New Member
2 0 0

The following instruction does not work for me:

I'm using Venture theme, do you have any suggestion? It's really make me a headache.

Thank you in advanced.

New Member
5 0 0

Hi Alex,


Thank you for the answer!!! I tried that and it seems to be working, if a variant is SOLD OUT, the customer will see that it's SOLD OUT. 

I wanted to ask you if it's possible to also show the option grayed out/disabled - if it's sold out. Not it still shows as "active". It's not a big problem, it's more of a nice to have, but I thought it will not hurt if I'm asking.


Thank you

8 0 1

Hi there, 

I am also trying this way:

and it does not seem to be working. I have a debut theme. Could someone please help mefigure out how to get my unavailable options not to show to potential customers?

Thanks so much!