All things Shopify and commerce
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.
Solved! Go to the solution
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 🙂
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 🙂
hy Marmeto thanks for suggetion but in this task i need to autohide soldout product can u pls suggest me any code
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 }}&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>
where i should put this code ?
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024