diff --git a/includes/payment-methods/class-wc-stripe-express-checkout-element.php b/includes/payment-methods/class-wc-stripe-express-checkout-element.php index 655d6691c..ed5b70355 100644 --- a/includes/payment-methods/class-wc-stripe-express-checkout-element.php +++ b/includes/payment-methods/class-wc-stripe-express-checkout-element.php @@ -85,6 +85,11 @@ public function init() { return; } + // Don't load for switch subscription page. + if ( isset( $_GET['switch-subscription'] ) ) { + return true; + } + add_action( 'template_redirect', [ $this, 'set_session' ] ); add_action( 'template_redirect', [ $this, 'handle_express_checkout_redirect' ] ); diff --git a/includes/payment-methods/class-wc-stripe-payment-request.php b/includes/payment-methods/class-wc-stripe-payment-request.php index 8061b6329..440fd19c8 100644 --- a/includes/payment-methods/class-wc-stripe-payment-request.php +++ b/includes/payment-methods/class-wc-stripe-payment-request.php @@ -104,6 +104,11 @@ public function __construct() { return; } + // Don't load for switch subscription page. + if ( isset( $_GET['switch-subscription'] ) ) { + return true; + } + $this->init(); }