How to hide the product inventory in specific collection

How to hide the product inventory in specific collection

hapq95
Visitor
2 0 0

I want to hide the product inventory, but just for one collection.

Captura de pantalla 2024-09-30 a la(s) 2.40.44 a.m..png

Replies 2 (2)

Moeed
Shopify Partner
5420 1463 1750

Hey @hapq95 

 

Welcome to Shopify Community! Can you share your Store URL so I can have a look on it? Also, if you have password enabled then please share the password as well. Your cooperation would be greatly appreciated.

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Custom Design | Advanced Coding | Store Modifications


PaulMartin
Shopify Partner
591 57 136

Hi @hapq95 

Are you looking to hide the product inventory for products inside a certain collection?

If so, your theme's code needs to be changed. First, you'll need to look for the code for the product inventory. Then, add a conditional like the one below in order to hide the product inventory of a product belonging to a certain collection. 

 

{% assign collection_to_exclude = collections['collection-name'] %}
{% unless product.collections contains collection_to_exclude %}
code for the product inventory
{% endunless %}

 

 After saving, that should hide the product inventory for products that belong to a certain collection. Be sure to change the code example I gave above as it will vary from theme to theme.

Hope this helps and if you have any questions, feel free to ask here or through my contact email below! 🙂👍

If you're uncomfortable with touching your theme's code because of instances where the theme might break, I'd be happy to do it for a fee. I'll make sure that the change we'll add doesn't break your theme and that the product inventory will hide according to your requirements. Let me know if you're interested via the comments or via my contact email below! 👌

[email protected]
Feel free to email me! 😄
I'm open to conversations or work ʕ •ᴥ•ʔ