From 77443557518d26fb84fec5ea512aadcdd87fd645 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Fri, 11 Jul 2025 17:21:11 +0200 Subject: [PATCH 1/2] Add transaction info call when cart or checkout update event is triggered --- modules/ppcp-applepay/resources/js/ApplepayButton.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/ppcp-applepay/resources/js/ApplepayButton.js b/modules/ppcp-applepay/resources/js/ApplepayButton.js index 155ab5d7b..cfb2d1d59 100644 --- a/modules/ppcp-applepay/resources/js/ApplepayButton.js +++ b/modules/ppcp-applepay/resources/js/ApplepayButton.js @@ -334,12 +334,22 @@ class ApplePayButton extends PaymentButton { this.checkEligibility(); } - reinit() { + async reinit() { // Missing (invalid) configuration indicates, that the first `init()` call did not happen yet. if ( ! this.validateConfiguration( true ) ) { return; } + // Ensures transaction info is updated in Apple Pay session when cart or checkout update events are triggered. + await this.contextHandler + .transactionInfo() + .then( ( transactionInfo ) => { + this.transactionInfo = transactionInfo; + } ) + .catch( ( error ) => { + console.error( 'Failed to get transaction info:', error ); + } ); + super.reinit(); this.init(); From fb35981e49dd1a39d28128805c435e372914bf47 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Fri, 11 Jul 2025 17:30:33 +0200 Subject: [PATCH 2/2] Add transaction info call when cart or checkout update event is triggered --- modules/ppcp-applepay/resources/js/ApplepayButton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ppcp-applepay/resources/js/ApplepayButton.js b/modules/ppcp-applepay/resources/js/ApplepayButton.js index cfb2d1d59..f0e5a8d7a 100644 --- a/modules/ppcp-applepay/resources/js/ApplepayButton.js +++ b/modules/ppcp-applepay/resources/js/ApplepayButton.js @@ -340,7 +340,7 @@ class ApplePayButton extends PaymentButton { return; } - // Ensures transaction info is updated in Apple Pay session when cart or checkout update events are triggered. + // Ensures transaction info is updated when cart or checkout update events are triggered. await this.contextHandler .transactionInfo() .then( ( transactionInfo ) => {