Shopify themes, liquid, logos, and UX
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
https://xfztr448onq3bqw1-71576191201.shopifypreview.com
please help to hide the buy now button when an item is soldout
Hi @Shahil1,
Go to your Shopify Admin Panel.
Navigate to Online Store → Themes.
Click on Edit Code (not Customize).
Open the theme.liquid file (found inside the Layout folder).
Scroll down and paste the code just before the </body> tag:
<script>
document.addEventListener("DOMContentLoaded", function () {
let disabledBtn = document.querySelector(".button[disabled], button[disabled], input[disabled]");
let buyNowBtn = document.querySelector(".shopify-payment-button");
if (disabledBtn && buyNowBtn) {
buyNowBtn.style.display = "none";
}
});
</script>
hi this hides the buy now button for all products on the mobile