From 604cea026be99eafa976bf19b0448595e2c63d55 Mon Sep 17 00:00:00 2001 From: Mayisha Date: Mon, 18 Nov 2024 13:23:54 +0600 Subject: [PATCH 1/3] hide express checkout buttons on switch subscription page --- .../class-wc-stripe-express-checkout-element.php | 5 +++++ includes/payment-methods/class-wc-stripe-payment-request.php | 5 +++++ 2 files changed, 10 insertions(+) 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(); } From 093a77e6978a0a2ad96058cebf2ddcf70cde7209 Mon Sep 17 00:00:00 2001 From: Mayisha Date: Mon, 18 Nov 2024 13:25:46 +0600 Subject: [PATCH 2/3] add changelog --- changelog.txt | 1 + readme.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/changelog.txt b/changelog.txt index 42fee089a..bd76e665f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ = 9.0.0 - xxxx-xx-xx = * Update - Improve accuracy of webhook status information displayed in settings page. * Tweak - Standardize ECE Express payment buttons on Pay for Order page to match cart and checkout itemization behavior. +* Fix - Do not load express payment buttons on switch subscription page. = 8.9.0 - 2024-11-14 = * Update - Enhance webhook processing to enable retrieving orders using payment_intent metadata. diff --git a/readme.txt b/readme.txt index 30eb23e79..3a817fa5c 100644 --- a/readme.txt +++ b/readme.txt @@ -113,5 +113,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o = 9.0.0 - xxxx-xx-xx = * Update - Improve accuracy of webhook status information displayed in settings page. * Tweak - Standardize ECE Express payment buttons on Pay for Order page to match cart and checkout itemization behavior. +* Fix - Do not load express payment buttons on switch subscription page. [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt). From 2a0929f135535e506deaf208debbc04e85f6c38d Mon Sep 17 00:00:00 2001 From: Mayisha Date: Mon, 18 Nov 2024 20:54:29 +0600 Subject: [PATCH 3/3] fix return statement --- .../class-wc-stripe-express-checkout-element.php | 2 +- includes/payment-methods/class-wc-stripe-payment-request.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 ed5b70355..d93458882 100644 --- a/includes/payment-methods/class-wc-stripe-express-checkout-element.php +++ b/includes/payment-methods/class-wc-stripe-express-checkout-element.php @@ -87,7 +87,7 @@ public function init() { // Don't load for switch subscription page. if ( isset( $_GET['switch-subscription'] ) ) { - return true; + return; } add_action( 'template_redirect', [ $this, 'set_session' ] ); diff --git a/includes/payment-methods/class-wc-stripe-payment-request.php b/includes/payment-methods/class-wc-stripe-payment-request.php index 440fd19c8..8b0997f70 100644 --- a/includes/payment-methods/class-wc-stripe-payment-request.php +++ b/includes/payment-methods/class-wc-stripe-payment-request.php @@ -106,7 +106,7 @@ public function __construct() { // Don't load for switch subscription page. if ( isset( $_GET['switch-subscription'] ) ) { - return true; + return; } $this->init();