Add to cart button shows as sold out when product is in stock

On some themes, the add to cart button may show as sold out when the product is in stock.

Themes with this issue:

  • Debutify

You can add code to the theme.liquid file after our app’s two lines of code to have the add to cart button show correctly.

How to edit code in your theme.liquid file

<script>
/* Fix add to cart text */
function bcpoChange(v) {
setTimeout(function () {
if (v.inventory_quantity > 0) {
bcpo.addToCart.html('Add to Cart').attr('disabled', false);
} else {
bcpo.addToCart.html('Sold out').attr('disabled', 'disabled');
}
}, 0);
}
</script>
You can also translate the ‘Add to Cart’ and ‘Sold out’ text in the code above if your website is in a different language
Was this article helpful?
Dislike

Pin It on Pinterest