Shopify themes, liquid, logos, and UX
Hey everyone,
I'm working on a Shopify site using a third-party theme, and I'm trying to automatically replace the "Pay with PayPal" button with a "Notify Me" button whenever a product or variant is out of stock. Here’s what I need it to do:
Work reliably on every page load and variant change
Ensure that clicking the "Notify Me" button doesn’t trigger the out-of-stock functionality by mistake
Improve response time: currently, on variant switch, the "Notify Me" button sometimes flashes briefly even when the product is in stock and PayPal buttons load afterward
My main goal is to keep the same functionality, but make the button update faster and more smoothly.
Also, when someone clicks "Notify Me", I want a popup to appear. If anyone has a good approach for this, I’d be happy to share the code I’ve been working with!
Appreciate any ideas or help—thanks so much! 🙏
This need to do a custom coding in order to achieve this.
Mainly there will use if, else condition. Mean if product sold out then the "Pay with Paypal" will display none.
This need to do coding based of your theme.
Hi @thescriptflow ,
Thanks for your suggestion! I tried to implement the code myself, but unfortunately I can't get it to work.
Would you possibly help me and implement the code directly for me? I would be very grateful if you could do this for me.
Many thanks in advance! 🙏
Hi @Leon09 ,
To replace the PayPal button with a "Notify Me" button when a variant is out of stock:
Hide PayPal and show "Notify Me" based on variant.available status.
Listen for variant:change to update buttons instantly when switching variants.
Use this code:
document.addEventListener('variant:change', function (e) {
const variant = e.detail.variant;
document.querySelector('.shopify-payment-button').style.display = variant.available ? 'block' : 'none';
document.getElementById('notify-me-btn').style.display = variant.available ? 'none' : 'block';
});
document.getElementById('notify-me-btn').addEventListener('click', function () {
// Trigger your popup here
alert('Notify me popup');
});
4. Prevent flashing by placing the Notify button in HTML but hiding it by default.
Hi @oscprofessional,
Thanks for your suggestion! I tried to implement the code myself, but unfortunately I can't get it to work.
Would you possibly help me and implement the code directly for me? I would be very grateful if you could do this for me.
Many thanks in advance! 🙏
Hi @Leon09 ,
If you're trying to automatically replace the PayPal button with a "Notify Me" option when a product is sold out, you might find it easier to use a no-code solution rather than custom code — especially if that code didn’t work as expected.
Our app, Mini: Coming Soon | Waitlist, does exactly that you asked for.
No code needed — it works with most themes out of the box, and setup takes just a few minutes.
Happy to help if you need assistance getting started!
Best,
Zel
Hey @Leon09 👋🏼 We got you covered on STOQ - our app for back in stock alerts & preorders. Worked with tens of thousands of merchants over the last 3 years on exactly the type of flow you're looking for.
1. STOQ tracks variant changes and works extremely reliably on all page loads.
2. Clicking our "Notify me" button won't trigger any add-to-cart flow.
3. Our button loads pretty much instantly, and we can have it so that your Paypal button never flashes/appears through some additional custom code.
4. With STOQ, you can set it up so customers see a popup when they click "Notify me" or you can show the popup directly on the page to improve conversion to signup.
We have a generous free plan and 24*7 support. Let me know if you have any questions or if there's anything we can do to get you set up. 🙂
Founder & CEO, Artos Software
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025