Feature Request - Publish/Unpublish Variants

I can’t see anywhere that I can request a feature update to be added to the Shopify Roadmap.

So I am posting it here in the hope that it will be picked up and passed on.

It would be AWESOME to be able to unpublish variants of a product. I know they can be made out of stock, but for instance, we launch new variants of an existing product, and it would be so much easier to be able to add them alongside existing variants ahead of time, but hide them from the front end.

To hide a specific product on the front end while keeping it live in the admin settings, you can follow these steps:

Add a tag to the product you want to hide. Let’s say you tag it with ‘your tag name’.

Modify your product display code as follows:

{% unless product.tags contains ‘your tag name’ %}

{% endunless %}

This code will ensure that the product is only displayed on the front end if it does not have the ‘your tag name’ tag. If the product has this tag, it will not be shown to users on the website.

Hi,

Hiding products is not a problem. It’s hiding specific variants of a product that I’d like to do. Is that possible with tags? I think only products can have tags not variants. Is that correct?

Yes, Variants do not have tags but still you can hide variants on base of their title

{% for variant in product.variants %}
{% unless variant.title == ‘Title of Variant to Hide’ or variant.option1 == ‘Option to Hide’ %}

{% endunless %}
{% endfor %}

1 Like

That’s a great start, thank you. We can do that and add a word that is nowhere else. As most of our products variants are colours we use on other products, we couldn’t do it just on the title as is.

Thanks so much for your help! I’ll implement it and see how we go :slightly_smiling_face:

I appreciate your gratitude.
Feel free to give the solution a try. If it works, please approve it. If it doesn’t, just let me know, and I’ll investigate the code more thoroughly.

Where would be the best place to put the code? I never designed the website so I am following someone elses code :expressionless_face:

I had a quick look at the product-form.liquid code but to be honest, I’m still learning all this!

To have me review your code, I require collaborator access to your store.