From f758f4c2c812efb6149b2ab71129e5f130ba49b9 Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Mon, 8 Jul 2024 15:25:16 +0200 Subject: [PATCH] AXO: Prevent loading scripts and executing logic in PayPal continuation mode --- modules/ppcp-axo/src/AxoModule.php | 7 +++---- modules/ppcp-button/src/Helper/ContextTrait.php | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/ppcp-axo/src/AxoModule.php b/modules/ppcp-axo/src/AxoModule.php index 8554e51b1..0482bd10f 100644 --- a/modules/ppcp-axo/src/AxoModule.php +++ b/modules/ppcp-axo/src/AxoModule.php @@ -148,7 +148,7 @@ class AxoModule implements ModuleInterface { $module = $this; // Check if the module is applicable, correct country, currency, ... etc. - if ( ! $c->get( 'axo.eligible' ) ) { + if ( ! $c->get( 'axo.eligible' ) || 'continuation' === $c->get( 'button.context' ) ) { return; } @@ -252,6 +252,8 @@ class AxoModule implements ModuleInterface { } ); + // Add the markup necessary for displaying overlays and loaders for Axo on the checkout page. + $this->add_checkout_loader_markup( $c ); }, 1 ); @@ -265,9 +267,6 @@ class AxoModule implements ModuleInterface { $endpoint->handle_request(); } ); - - // Add the markup necessary for displaying overlays and loaders for Axo on the checkout page. - $this->add_checkout_loader_markup( $c ); } /** diff --git a/modules/ppcp-button/src/Helper/ContextTrait.php b/modules/ppcp-button/src/Helper/ContextTrait.php index a034eda8b..0c1bb4201 100644 --- a/modules/ppcp-button/src/Helper/ContextTrait.php +++ b/modules/ppcp-button/src/Helper/ContextTrait.php @@ -137,6 +137,10 @@ trait ContextTrait { case $this->is_block_editor(): $context = 'block-editor'; break; + + case $this->is_paypal_continuation(): + $context = 'continuation'; + break; } return apply_filters( 'woocommerce_paypal_payments_context', $context );