Skip to content

Commit

Permalink
Fix rerender ApplePay and GooglePay upon cart refresh.
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrosilva-pt committed Dec 18, 2023
1 parent 4f75762 commit 7f5836e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/ppcp-applepay/resources/js/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ import ApplepayManager from "./ApplepayManager";
}
});

// Use set timeout as it's unnecessary to refresh upon Minicart initial render.
setTimeout(() => {
jQuery(document.body).on('wc_fragments_loaded wc_fragments_refreshed', () => {
if (manager) {
manager.reinit();
}
});
}, 1000);

document.addEventListener(
'DOMContentLoaded',
() => {
Expand Down
9 changes: 9 additions & 0 deletions modules/ppcp-googlepay/resources/js/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ import GooglepayManager from "./GooglepayManager";
}
});

// Use set timeout as it's unnecessary to refresh upon Minicart initial render.
setTimeout(() => {
jQuery(document.body).on('wc_fragments_loaded wc_fragments_refreshed', () => {
if (manager) {
manager.reinit();
}
});
}, 1000);

document.addEventListener(
'DOMContentLoaded',
() => {
Expand Down

0 comments on commit 7f5836e

Please sign in to comment.