Have your say in Community Polls: What was/is your greatest motivation to start your own business?

automatically hide soldout product from only cart using shopify store app or by using any plugin

Solved

automatically hide soldout product from only cart using shopify store app or by using any plugin

Ramiz-Raja-Khan
Visitor
2 0 0

Some customer adds the products to their cart, and they forget after adding them. But after sometimes they come back to the site and check their cart but some products have been sold out.
So we have to find a solution for the out-of-stock products automatically removed from the cart.

Accepted Solution (1)

marmeto
Shopify Partner
17 1 1

This is an accepted solution.

Hey Ramiz,

We are not sure if an app can solve the problem, but definitely, with small coding customization, this can be achieved. The logic for the same will be " As soon as the customer reaches cart page - check the products - check their real-time inventory - list/unlist products accordingly ". The UX can be adjusted by a loader but this should solve the problem for you.

Hope this helps 🙂

Building Solutions on Shopify

View solution in original post

Replies 4 (4)

marmeto
Shopify Partner
17 1 1

This is an accepted solution.

Hey Ramiz,

We are not sure if an app can solve the problem, but definitely, with small coding customization, this can be achieved. The logic for the same will be " As soon as the customer reaches cart page - check the products - check their real-time inventory - list/unlist products accordingly ". The UX can be adjusted by a loader but this should solve the problem for you.

Hope this helps 🙂

Building Solutions on Shopify
Ramiz-Raja-Khan
Visitor
2 0 0

hy Marmeto thanks for suggetion but in this task i need to autohide  soldout product can u pls suggest me any code 

ramizrajakhans2
Visitor
1 0 0

finally i got solution of this problem basically  i use this condition on remove button and by using document.getElementById we can auto remove only soldout product from cart only not collection so  firstly 


1. 
<p class="remove">

{% if item.variant.available == false %}

<a href="/cart/change?line={{ forloop.index }}&amp;quantity=0" id="rm-link-{{ forloop.index }}" class="text-link text-link--accent" aria-label="{{ 'cart.label.remove' | t: product: item.title }}" data-cart-remove data-role="product-remove">{{ 'cart.general.remove' | t }}</a> 

{% endif %}
</p> 

2.    
<script>
document.getElementById('rm-link-1').click();
</script>

AhmedFathy12
Shopify Partner
46 1 4

where i should put this code ?