mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
🐛 Fix incorrect event listeners
This commit is contained in:
parent
dada95520e
commit
c382b5cee1
1 changed files with 5 additions and 2 deletions
|
@ -26,8 +26,11 @@ export function setupButtonEvents( refresh ) {
|
|||
document.addEventListener( REFRESH_BUTTON_EVENT, debouncedRefresh );
|
||||
|
||||
// Listen for cart and checkout update events.
|
||||
document.body.addEventListener( 'updated_cart_totals', debouncedRefresh );
|
||||
document.body.addEventListener( 'updated_checkout', debouncedRefresh );
|
||||
// Note: we need jQuery here, because WooCommerce uses jQuery.trigger() to dispatch the events.
|
||||
window
|
||||
.jQuery( 'body' )
|
||||
.on( 'updated_cart_totals', debouncedRefresh )
|
||||
.on( 'updated_checkout', debouncedRefresh );
|
||||
|
||||
// Use setTimeout for fragment events to avoid unnecessary refresh on initial render.
|
||||
setTimeout( () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue