Skip to content

Commit dbb908b

Browse files
wjrosadiegocurbelomalithsen
authored
Deprecating the UPE preview feature flag and removing its usages (#4760)
* Deprecating the UPE preview feature flag and remove its usages * Readme and changelog entries * Update includes/class-wc-stripe.php Co-authored-by: Diego Curbelo <[email protected]> * Removing unused settings key * Update includes/class-wc-stripe-feature-flags.php Co-authored-by: Malith Senaweera <[email protected]> * Update UPE availability note comment * Removing invalid unit test * Update setup PHP action version * Revert action change --------- Co-authored-by: Diego Curbelo <[email protected]> Co-authored-by: Malith Senaweera <[email protected]>
1 parent e383674 commit dbb908b

File tree

9 files changed

+42
-122
lines changed

9 files changed

+42
-122
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Fix - Ensure Amazon Pay, Apple Pay, and Google Pay display settings are managed correctly
77
* Dev - Add logging with DNS resolution diagnostics for URL validation issues when calling Stripe API
88
* Fix - Allow payment methods to be disabled when they are not available
9+
* Dev - Removes the `_wcstripe_feature_upe` feature flag and the related method from the `WC_Stripe_Feature_Flags` class
910
* Dev - Fixes some incorrect subscriptions support implementations for payment methods
1011

1112
= 10.1.0 - 2025-11-11 =

includes/admin/stripe-settings.php

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -291,44 +291,19 @@
291291
]
292292
);
293293

294-
if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
295-
// in the new settings, "checkout" is going to be enabled by default (if it is a new WCStripe installation).
296-
$stripe_settings['express_checkout_button_locations']['default'][] = 'checkout';
294+
// in the new settings, "checkout" is going to be enabled by default (if it is a new WCStripe installation).
295+
$stripe_settings['express_checkout_button_locations']['default'][] = 'checkout';
297296

298-
// no longer needed in the new settings.
299-
unset( $stripe_settings['express_checkout_button_branded_type'] );
300-
unset( $stripe_settings['express_checkout_button_height'] );
301-
unset( $stripe_settings['express_checkout_button_label'] );
302-
// injecting some of the new options.
303-
$stripe_settings['express_checkout_button_type']['options']['default'] = __( 'Only icon', 'woocommerce-gateway-stripe' );
304-
$stripe_settings['express_checkout_button_type']['options']['book'] = __( 'Book', 'woocommerce-gateway-stripe' );
305-
// no longer valid options.
306-
unset( $stripe_settings['express_checkout_button_type']['options']['branded'] );
307-
unset( $stripe_settings['express_checkout_button_type']['options']['custom'] );
308-
} else {
309-
unset( $stripe_settings['express_checkout_button_size'] );
310-
}
311-
312-
if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
313-
$upe_settings = [
314-
WC_Stripe_Feature_Flags::UPE_CHECKOUT_FEATURE_ATTRIBUTE_NAME => [
315-
'title' => __( 'New checkout experience', 'woocommerce-gateway-stripe' ),
316-
'label' => sprintf(
317-
/* translators: 1) br tag 2) Stripe anchor tag 3) Apple anchor tag 4) Stripe dashboard opening anchor tag 5) Stripe dashboard closing anchor tag */
318-
__( 'Try the new payment experience (Early access) %1$sGet early access to a new, smarter payment experience on checkout and let us know what you think by %2$s. We recommend this feature for experienced merchants as the functionality is currently limited. %3$s', 'woocommerce-gateway-stripe' ),
319-
'<br />',
320-
'<a href="https://woocommerce.survey.fm/woocommerce-stripe-upe-opt-out-survey" target="_blank">submitting your feedback</a>',
321-
'<a href="https://woocommerce.com/document/stripe/admin-experience/new-checkout-experience/" target="_blank">Learn more</a>'
322-
),
323-
'type' => 'checkbox',
324-
'description' => __( 'New checkout experience allows you to manage all payment methods on one screen and display them to customers based on their currency and location.', 'woocommerce-gateway-stripe' ),
325-
'default' => 'no',
326-
'desc_tip' => true,
327-
],
328-
];
329-
// Insert UPE options below the 'logging' setting.
330-
$stripe_settings = array_merge( $stripe_settings, $upe_settings );
331-
}
297+
// no longer needed in the new settings.
298+
unset( $stripe_settings['express_checkout_button_branded_type'] );
299+
unset( $stripe_settings['express_checkout_button_height'] );
300+
unset( $stripe_settings['express_checkout_button_label'] );
301+
// injecting some of the new options.
302+
$stripe_settings['express_checkout_button_type']['options']['default'] = __( 'Only icon', 'woocommerce-gateway-stripe' );
303+
$stripe_settings['express_checkout_button_type']['options']['book'] = __( 'Book', 'woocommerce-gateway-stripe' );
304+
// no longer valid options.
305+
unset( $stripe_settings['express_checkout_button_type']['options']['branded'] );
306+
unset( $stripe_settings['express_checkout_button_type']['options']['custom'] );
332307

333308
return apply_filters(
334309
'wc_stripe_settings',

includes/class-wc-stripe-feature-flags.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ public static function is_stripe_ece_enabled() {
9393
* This allows the merchant to enable/disable UPE checkout.
9494
*
9595
* @return bool
96+
*
97+
* @deprecated 10.1.0 UPE is always enabled. This method will be removed in a future release.
9698
*/
9799
public static function is_upe_preview_enabled() {
98-
return 'yes' === self::get_option_with_default( '_wcstripe_feature_upe' );
100+
return true;
99101
}
100102

101103
/**

includes/class-wc-stripe.php

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,6 @@ function ( $method ) {
540540
*/
541541
public function filter_gateway_order_admin( $sections ) {
542542
unset( $sections['stripe'] );
543-
if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
544-
unset( $sections['stripe_upe'] );
545-
}
546543
unset( $sections['stripe_bancontact'] );
547544
unset( $sections['stripe_sofort'] );
548545
unset( $sections['stripe_giropay'] );
@@ -553,10 +550,9 @@ public function filter_gateway_order_admin( $sections ) {
553550
unset( $sections['stripe_sepa'] );
554551
unset( $sections['stripe_multibanco'] );
555552

556-
$sections['stripe'] = 'Stripe';
557-
if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
558-
$sections['stripe_upe'] = 'Stripe checkout experience';
559-
}
553+
$sections['stripe'] = 'Stripe';
554+
$sections['stripe_upe'] = 'Stripe checkout experience';
555+
560556
$sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' );
561557
$sections['stripe_sofort'] = __( 'Stripe Sofort', 'woocommerce-gateway-stripe' );
562558
$sections['stripe_giropay'] = __( 'Stripe giropay', 'woocommerce-gateway-stripe' );
@@ -591,10 +587,6 @@ public function gateway_settings_update( $settings, $old_settings ) {
591587
// Note that we need to run these checks before we call toggle_upe() below.
592588
$this->maybe_reset_stripe_in_memory_key( $settings, $old_settings );
593589

594-
if ( ! WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
595-
return $settings;
596-
}
597-
598590
return $this->toggle_upe( $settings, $old_settings );
599591
}
600592

@@ -790,24 +782,22 @@ public function register_routes() {
790782
$oauth_connect->register_routes();
791783
$stripe_account_controller->register_routes();
792784

793-
if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
794-
require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-rest-stripe-settings-controller.php';
795-
require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-stripe-rest-upe-flag-toggle-controller.php';
796-
require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-rest-stripe-account-keys-controller.php';
797-
require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-stripe-rest-oc-setting-toggle-controller.php';
785+
require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-rest-stripe-settings-controller.php';
786+
require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-stripe-rest-upe-flag-toggle-controller.php';
787+
require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-rest-stripe-account-keys-controller.php';
788+
require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-stripe-rest-oc-setting-toggle-controller.php';
798789

799-
$upe_flag_toggle_controller = new WC_Stripe_REST_UPE_Flag_Toggle_Controller();
800-
$upe_flag_toggle_controller->register_routes();
790+
$upe_flag_toggle_controller = new WC_Stripe_REST_UPE_Flag_Toggle_Controller();
791+
$upe_flag_toggle_controller->register_routes();
801792

802-
$settings_controller = new WC_REST_Stripe_Settings_Controller( $this->get_main_stripe_gateway() );
803-
$settings_controller->register_routes();
793+
$settings_controller = new WC_REST_Stripe_Settings_Controller( $this->get_main_stripe_gateway() );
794+
$settings_controller->register_routes();
804795

805-
$stripe_account_keys_controller = new WC_REST_Stripe_Account_Keys_Controller( $this->account );
806-
$stripe_account_keys_controller->register_routes();
796+
$stripe_account_keys_controller = new WC_REST_Stripe_Account_Keys_Controller( $this->account );
797+
$stripe_account_keys_controller->register_routes();
807798

808-
$oc_setting_toggle_controller = new WC_Stripe_REST_OC_Setting_Toggle_Controller( $this->get_main_stripe_gateway() );
809-
$oc_setting_toggle_controller->register_routes();
810-
}
799+
$oc_setting_toggle_controller = new WC_Stripe_REST_OC_Setting_Toggle_Controller( $this->get_main_stripe_gateway() );
800+
$oc_setting_toggle_controller->register_routes();
811801
}
812802

813803
/**

includes/notes/class-wc-stripe-upe-availability-note.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,10 @@ private static function get_note_class() {
7373
public static function init() {
7474
/**
7575
* No need to display the admin inbox note when
76-
* - UPE preview is disabled
7776
* - UPE is already enabled
7877
* - UPE has been manually disabled
7978
* - Stripe is not enabled
8079
*/
81-
if ( ! WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
82-
return;
83-
}
84-
8580
if ( WC_Stripe_Feature_Flags::is_upe_checkout_enabled() ) {
8681
return;
8782
}

includes/payment-methods/class-wc-stripe-payment-request.php

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,6 @@ public function get_button_theme() {
283283
* @return string
284284
*/
285285
public function get_button_height() {
286-
if ( ! WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
287-
return isset( $this->stripe_settings['payment_request_button_height'] ) ? str_replace( 'px', '', $this->stripe_settings['payment_request_button_height'] ) : '64';
288-
}
289-
290286
$height = isset( $this->stripe_settings['payment_request_button_size'] ) ? $this->stripe_settings['payment_request_button_size'] : 'default';
291287
if ( 'small' === $height ) {
292288
return '40';
@@ -330,12 +326,7 @@ public function get_button_branded_type() {
330326
* @return boolean
331327
*/
332328
public function is_custom_button() {
333-
// no longer a valid option
334-
if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
335-
return false;
336-
}
337-
338-
return 'custom' === $this->get_button_type();
329+
return false;
339330
}
340331

341332
/**
@@ -357,12 +348,7 @@ public function custom_button_selector() {
357348
* @return string
358349
*/
359350
public function get_button_label() {
360-
// no longer a valid option
361-
if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
362-
return '';
363-
}
364-
365-
return isset( $this->stripe_settings['payment_request_button_label'] ) ? $this->stripe_settings['payment_request_button_label'] : 'Buy now';
351+
return '';
366352
}
367353

368354
/**
@@ -1824,32 +1810,18 @@ public function get_button_settings() {
18241810
// it would be DRYer to use `array_merge`,
18251811
// but I thought that this approach might be more straightforward to clean up when we remove the feature flag code.
18261812
$button_type = $this->get_button_type();
1827-
if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) {
1828-
return [
1829-
'type' => $button_type,
1830-
'theme' => $this->get_button_theme(),
1831-
'height' => $this->get_button_height(),
1832-
// Default format is en_US.
1833-
'locale' => apply_filters( 'wc_stripe_payment_request_button_locale', substr( get_locale(), 0, 2 ) ),
1834-
'branded_type' => 'default' === $button_type ? 'short' : 'long',
1835-
// these values are no longer applicable - all the JS relying on them can be removed.
1836-
'css_selector' => '',
1837-
'label' => '',
1838-
'is_custom' => false,
1839-
'is_branded' => false,
1840-
];
1841-
}
1842-
18431813
return [
18441814
'type' => $button_type,
18451815
'theme' => $this->get_button_theme(),
18461816
'height' => $this->get_button_height(),
1847-
'locale' => apply_filters( 'wc_stripe_payment_request_button_locale', substr( get_locale(), 0, 2 ) ),
18481817
// Default format is en_US.
1849-
'is_custom' => $this->is_custom_button(),
1850-
'is_branded' => $this->is_branded_button(),
1851-
'css_selector' => $this->custom_button_selector(),
1852-
'branded_type' => $this->get_button_branded_type(),
1818+
'locale' => apply_filters( 'wc_stripe_payment_request_button_locale', substr( get_locale(), 0, 2 ) ),
1819+
'branded_type' => 'default' === $button_type ? 'short' : 'long',
1820+
// these values are no longer applicable - all the JS relying on them can be removed.
1821+
'css_selector' => '',
1822+
'label' => '',
1823+
'is_custom' => false,
1824+
'is_branded' => false,
18531825
];
18541826
}
18551827

includes/payment-methods/class-wc-stripe-upe-payment-gateway.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function __construct() {
248248
$this->statement_descriptor = ! empty( $main_settings['statement_descriptor'] ) ? $main_settings['statement_descriptor'] : '';
249249

250250
// When feature flags are enabled, title shows the count of enabled payment methods in settings page only.
251-
if ( WC_Stripe_Feature_Flags::is_upe_checkout_enabled() && WC_Stripe_Feature_Flags::is_upe_preview_enabled() && isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && isset( $_GET['tab'] ) && 'checkout' === $_GET['tab'] ) {
251+
if ( WC_Stripe_Feature_Flags::is_upe_checkout_enabled() && isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && isset( $_GET['tab'] ) && 'checkout' === $_GET['tab'] ) {
252252
$enabled_payment_methods_count = count( $enabled_payment_methods );
253253
$this->title = $enabled_payment_methods_count ?
254254
/* translators: $1. Count of enabled payment methods. */

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
116116
* Fix - Ensure Amazon Pay, Apple Pay, and Google Pay display settings are managed correctly
117117
* Dev - Add logging with DNS resolution diagnostics for URL validation issues when calling Stripe API
118118
* Fix - Allow payment methods to be disabled when they are not available
119+
* Dev - Removes the `_wcstripe_feature_upe` feature flag and the related method from the `WC_Stripe_Feature_Flags` class
119120
* Dev - Fixes some incorrect subscriptions support implementations for payment methods
120121

121122
[See changelog for full details across versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

tests/phpunit/WC_Stripe_Helper_Test.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -799,22 +799,6 @@ public function statement_descriptor_sanitation_provider() {
799799
];
800800
}
801801

802-
public function test_turning_on_upe_with_no_stripe_legacy_payment_methods_enabled_will_not_turn_on_the_upe_gateway_and_default_to_card_and_link() {
803-
$this->upe_helper->enable_upe_feature_flag();
804-
805-
$stripe_settings = WC_Stripe_Helper::get_stripe_settings();
806-
$this->assertEquals( 'no', $stripe_settings['enabled'] );
807-
$this->assertEquals( 'no', $stripe_settings['upe_checkout_experience_enabled'] );
808-
809-
$stripe_settings['upe_checkout_experience_enabled'] = 'yes';
810-
WC_Stripe_Helper::update_main_stripe_settings( $stripe_settings );
811-
812-
$stripe_settings = WC_Stripe_Helper::get_stripe_settings();
813-
// Because no Stripe LPM's were enabled when UPE was enabled, the Stripe gateway is not enabled yet.
814-
$this->assertEquals( 'no', $stripe_settings['enabled'] );
815-
$this->assertEquals( 'yes', $stripe_settings['upe_checkout_experience_enabled'] );
816-
}
817-
818802
public function test_turning_on_upe_enables_the_correct_upe_methods_based_on_which_legacy_payment_methods_were_enabled() {
819803
update_option( 'woocommerce_currency', 'EUR' );
820804
$this->upe_helper->enable_upe_feature_flag();

0 commit comments

Comments
 (0)