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

Please hid the buy now button when an item is soldout.

Please hid the buy now button when an item is soldout.

Shahil1
Excursionist
79 0 10
Replies 2 (2)

CodingFifty
Shopify Partner
1102 161 190

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>

 

Coding Fifty || Shopify Partner
For any custom section queries, please visit: Fiverr Profile
Found my response useful? Like it and mark as Accepted Solution!
For additional discussions, reach out via: Email ID: codingfifty@gmail.com
Shahil1
Excursionist
79 0 10

hi this hides the buy now button for all products on the mobile