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 the <head> tag 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 bcpoDone() {
var atc = bcpo.$('.product-single__add-to-cart > [name="add"]');
setInterval(function () {
if (bcpo.variant.available) {
atc.attr('disabled', false).removeClass('disabled').find('.btn__add-to-cart-text').html('Add to Cart');
} else {
atc.attr('disabled', 'disabled').addClass('disabled').find('.btn__add-to-cart-text').html('Sold Out');
}
}, 900);
}
</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