icreatewebtech
Forum Replies Created
-
Hi,
Yes, that’s correct — I’m currently using the legacy checkout (not checkout blocks), so the issue was happening within that flow.
That makes sense regarding the event handler. Your observation about the
on()handler registering the same event multiple times explains the behavior I was seeing. After adjusting the modalcheckout.js handling on my side, it started working as expected.Really appreciate you digging into this and confirming the root cause. Glad to hear it will be included in the next release — that should help avoid similar issues going forward.
Thanks again for the support and quick follow-up!
Best regards,
<span style=”font-size: inherit;”>Hi,</span>
Thank you for checking this and for sharing the video — that really helped.
I revisited the issue on my side and was able to identify the cause. It looks like the problem was related to the modal checkout script. I made a small change in the modalCheckout.js file, and after that adjustment, the flow is now working correctly for me as well.
The fix is a single line added in
modalCheckout.js— add.off()before.on()to prevent duplicate handler attachment:File:
btcpay-greenfield-for-woocommerce/assets/js/frontend/modalCheckout.js(line 191)if (selected_gateway.startsWith(‘btcpaygf_’)) {
// Remove any existing handler first to prevent duplicates.
checkout_form.off(‘checkout_place_order’, submitOrder);
// Bind our custom event handler to the checkout button.
checkout_form.on(‘checkout_place_order’, submitOrder);
}Now, when applying points:
The order is created with the correct discounted price
The BTCPay invoice also reflects the discounted amount properly
Both modal overlay and redirect checkout are functioning as expected
So it seems the issue was likely due to a script conflict or how the modal was handling the updated totals during checkout.
At this point, everything is working fine on my end. I’ll continue to monitor it, but it looks resolved after this fix.
Really appreciate your support on this!
Best regards,
Yes, I’m using the “Points and Rewards for WooCommerce Pro” plugin from WPSwings. Since it’s the Pro version, I’m not sure whether the issue also exists in the free version or not.