
JavaScript method
If you’re facing an out-of-stock product with the Add to Cart button still visible, copy and paste the JavaScript below into your site script manager.
<script>
const style = document.createElement('style');
style.textContent = `
.add-to-cart-wrapper[productoutofstock] {
display: none !important;
}
`;
const footer = document.querySelector('footer');
if (footer) {
footer.appendChild(style);
} else {
document.body.appendChild(style);
}
</script>
