out of stock product

3 0 0

how can Automatically remove something that is sold out from the shopping bag.

I try to add code in cart-template.liquid  but its not working  ,anyone have this type of solution?

{% for variant in product.variants %}
{% if variant.available %}
{% endif %}
{% endfor %}

Reply 1 (1)
Shopify Staff
390 41 51

Hello @Surbhi106!


The way to automatically hide out of stock products is through automatic collections which you may have already set up.


Automatic collections work based on conditions, so if you're tracking stock for your products you need to make sure to add a condition to each collection that says inventory stock is greater than 0:




That way, any products that go below 1 in inventory will be automatically removed from the collections. Have you tried this already?


Also, please do tell me a little bit more about your store and products, I will see if there is anything else I can be of help with! 

Lana | Social Care @ Shopify 
 - Out of Office until Jan 2nd / Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog