Merge pull request #2372 from woocommerce/PCP-3250-apple-pay-and-google-pay-buttons-dont-appear-in-pay-pal-button-stack-on-multi-step-checkout

Apple Pay and Google Pay buttons don't appear in PayPal Button stack on multi-step Checkout (3250)
This commit is contained in:
Emili Castells 2024-07-02 11:05:09 +02:00 committed by GitHub
commit 6785ca9b06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 164 additions and 20 deletions

View file

@ -1,6 +1,7 @@
import {loadCustomScript} from "@paypal/paypal-js";
import {loadPaypalScript} from "../../../ppcp-button/resources/js/modules/Helper/ScriptLoading";
import GooglepayManager from "./GooglepayManager";
import {setupButtonEvents} from '../../../ppcp-button/resources/js/modules/Helper/ButtonRefreshHelper';
(function ({
buttonConfig,
@ -15,21 +16,12 @@ import GooglepayManager from "./GooglepayManager";
manager.init();
};
jQuery(document.body).on('updated_cart_totals updated_checkout', () => {
setupButtonEvents(function() {
if (manager) {
manager.reinit();
}
});
// 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',
() => {