Hiding sold out variants in the product page with selected collections

Hi everyone,

I just want to ask if there is a way that we can hide sold-out variants of a selected collections only.

hope you can help me. thank you.

Hey @Macoy102890

Follow these Steps:

  1. Go to Online Store

  2. Edit Code

  3. Find theme.liquid file

  4. Add the following code in the bottom of the file above tag


RESULT:

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

Best Regards,
Moeed

Hi Mooed. thank you for your response, May I ask If I can apply this in a specific collection. thank you

Can you send me the link of the collection on which you want this code to work on only?

Best Regards,

Moeed

this is the url:

https://www.naraya.com/collections/beyond-sight

Hey @Macoy102890

Follow these Steps:

  1. Go to Online Store

  2. Edit Code

  3. Find theme.liquid file

  4. Add the following code in the bottom of the file above tag

{% for c in product.collections %}
{% if c.handle == "beyond-sight" %}

{% endif %}
{% endfor %}

RESULT:

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

Best Regards,
Moeed

Thank you Moeed… you’re awsome!! :oncoming_fist:

Thank you for your reply. I’m glad to hear that the solution worked well for you. If you require any more help, please don’t hesitate to reach out. If you find this information useful, a Like would be greatly appreciated.

Thank you for this helpful solution. When I attempted this code fix, it worked for most items, but there are still some items showing Sold Out. Do you know what might cause that?

Third-party apps make it easy to separate variants I own the Stamp ‑ Variants on Collection and we help merchants display variants separately on the collection page and home page. You can customize the settings per collection to show or hide specific variants, filter variants, or separate them by specific options. For example, you can create a “Gold” collection and display only gold-related variants.
https://youtu.be/Pdk4JmfJjqQ