diff --git a/changelog.txt b/changelog.txt index 45e42b5f47..ae5684326d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,7 @@ * Fix - Ensure Amazon Pay, Apple Pay, and Google Pay display settings are managed correctly * Dev - Add logging with DNS resolution diagnostics for URL validation issues when calling Stripe API * Fix - Allow payment methods to be disabled when they are not available +* Dev - Removes the `_wcstripe_feature_upe` feature flag and the related method from the `WC_Stripe_Feature_Flags` class * Dev - Fixes some incorrect subscriptions support implementations for payment methods = 10.1.0 - 2025-11-11 = diff --git a/includes/admin/stripe-settings.php b/includes/admin/stripe-settings.php index 541669e0e6..a6eb2f0d01 100644 --- a/includes/admin/stripe-settings.php +++ b/includes/admin/stripe-settings.php @@ -291,44 +291,19 @@ ] ); -if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - // in the new settings, "checkout" is going to be enabled by default (if it is a new WCStripe installation). - $stripe_settings['express_checkout_button_locations']['default'][] = 'checkout'; +// in the new settings, "checkout" is going to be enabled by default (if it is a new WCStripe installation). +$stripe_settings['express_checkout_button_locations']['default'][] = 'checkout'; - // no longer needed in the new settings. - unset( $stripe_settings['express_checkout_button_branded_type'] ); - unset( $stripe_settings['express_checkout_button_height'] ); - unset( $stripe_settings['express_checkout_button_label'] ); - // injecting some of the new options. - $stripe_settings['express_checkout_button_type']['options']['default'] = __( 'Only icon', 'woocommerce-gateway-stripe' ); - $stripe_settings['express_checkout_button_type']['options']['book'] = __( 'Book', 'woocommerce-gateway-stripe' ); - // no longer valid options. - unset( $stripe_settings['express_checkout_button_type']['options']['branded'] ); - unset( $stripe_settings['express_checkout_button_type']['options']['custom'] ); -} else { - unset( $stripe_settings['express_checkout_button_size'] ); -} - -if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - $upe_settings = [ - WC_Stripe_Feature_Flags::UPE_CHECKOUT_FEATURE_ATTRIBUTE_NAME => [ - 'title' => __( 'New checkout experience', 'woocommerce-gateway-stripe' ), - 'label' => sprintf( - /* translators: 1) br tag 2) Stripe anchor tag 3) Apple anchor tag 4) Stripe dashboard opening anchor tag 5) Stripe dashboard closing anchor tag */ - __( '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' ), - '
', - 'submitting your feedback', - 'Learn more' - ), - 'type' => 'checkbox', - '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' ), - 'default' => 'no', - 'desc_tip' => true, - ], - ]; - // Insert UPE options below the 'logging' setting. - $stripe_settings = array_merge( $stripe_settings, $upe_settings ); -} +// no longer needed in the new settings. +unset( $stripe_settings['express_checkout_button_branded_type'] ); +unset( $stripe_settings['express_checkout_button_height'] ); +unset( $stripe_settings['express_checkout_button_label'] ); +// injecting some of the new options. +$stripe_settings['express_checkout_button_type']['options']['default'] = __( 'Only icon', 'woocommerce-gateway-stripe' ); +$stripe_settings['express_checkout_button_type']['options']['book'] = __( 'Book', 'woocommerce-gateway-stripe' ); +// no longer valid options. +unset( $stripe_settings['express_checkout_button_type']['options']['branded'] ); +unset( $stripe_settings['express_checkout_button_type']['options']['custom'] ); return apply_filters( 'wc_stripe_settings', diff --git a/includes/class-wc-stripe-feature-flags.php b/includes/class-wc-stripe-feature-flags.php index c39714686f..4accf029d8 100644 --- a/includes/class-wc-stripe-feature-flags.php +++ b/includes/class-wc-stripe-feature-flags.php @@ -93,9 +93,11 @@ public static function is_stripe_ece_enabled() { * This allows the merchant to enable/disable UPE checkout. * * @return bool + * + * @deprecated 10.1.0 UPE is always enabled. This method will be removed in a future release. */ public static function is_upe_preview_enabled() { - return 'yes' === self::get_option_with_default( '_wcstripe_feature_upe' ); + return true; } /** diff --git a/includes/class-wc-stripe.php b/includes/class-wc-stripe.php index a92196e66e..296d19f8aa 100644 --- a/includes/class-wc-stripe.php +++ b/includes/class-wc-stripe.php @@ -540,9 +540,6 @@ function ( $method ) { */ public function filter_gateway_order_admin( $sections ) { unset( $sections['stripe'] ); - if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - unset( $sections['stripe_upe'] ); - } unset( $sections['stripe_bancontact'] ); unset( $sections['stripe_sofort'] ); unset( $sections['stripe_giropay'] ); @@ -553,10 +550,9 @@ public function filter_gateway_order_admin( $sections ) { unset( $sections['stripe_sepa'] ); unset( $sections['stripe_multibanco'] ); - $sections['stripe'] = 'Stripe'; - if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - $sections['stripe_upe'] = 'Stripe checkout experience'; - } + $sections['stripe'] = 'Stripe'; + $sections['stripe_upe'] = 'Stripe checkout experience'; + $sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' ); $sections['stripe_sofort'] = __( 'Stripe Sofort', 'woocommerce-gateway-stripe' ); $sections['stripe_giropay'] = __( 'Stripe giropay', 'woocommerce-gateway-stripe' ); @@ -591,10 +587,6 @@ public function gateway_settings_update( $settings, $old_settings ) { // Note that we need to run these checks before we call toggle_upe() below. $this->maybe_reset_stripe_in_memory_key( $settings, $old_settings ); - if ( ! WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - return $settings; - } - return $this->toggle_upe( $settings, $old_settings ); } @@ -790,24 +782,22 @@ public function register_routes() { $oauth_connect->register_routes(); $stripe_account_controller->register_routes(); - if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-rest-stripe-settings-controller.php'; - require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-stripe-rest-upe-flag-toggle-controller.php'; - require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-rest-stripe-account-keys-controller.php'; - require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-stripe-rest-oc-setting-toggle-controller.php'; + require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-rest-stripe-settings-controller.php'; + require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-stripe-rest-upe-flag-toggle-controller.php'; + require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-rest-stripe-account-keys-controller.php'; + require_once WC_STRIPE_PLUGIN_PATH . '/includes/admin/class-wc-stripe-rest-oc-setting-toggle-controller.php'; - $upe_flag_toggle_controller = new WC_Stripe_REST_UPE_Flag_Toggle_Controller(); - $upe_flag_toggle_controller->register_routes(); + $upe_flag_toggle_controller = new WC_Stripe_REST_UPE_Flag_Toggle_Controller(); + $upe_flag_toggle_controller->register_routes(); - $settings_controller = new WC_REST_Stripe_Settings_Controller( $this->get_main_stripe_gateway() ); - $settings_controller->register_routes(); + $settings_controller = new WC_REST_Stripe_Settings_Controller( $this->get_main_stripe_gateway() ); + $settings_controller->register_routes(); - $stripe_account_keys_controller = new WC_REST_Stripe_Account_Keys_Controller( $this->account ); - $stripe_account_keys_controller->register_routes(); + $stripe_account_keys_controller = new WC_REST_Stripe_Account_Keys_Controller( $this->account ); + $stripe_account_keys_controller->register_routes(); - $oc_setting_toggle_controller = new WC_Stripe_REST_OC_Setting_Toggle_Controller( $this->get_main_stripe_gateway() ); - $oc_setting_toggle_controller->register_routes(); - } + $oc_setting_toggle_controller = new WC_Stripe_REST_OC_Setting_Toggle_Controller( $this->get_main_stripe_gateway() ); + $oc_setting_toggle_controller->register_routes(); } /** diff --git a/includes/notes/class-wc-stripe-upe-availability-note.php b/includes/notes/class-wc-stripe-upe-availability-note.php index d9b3c93a60..0b3c67ad56 100644 --- a/includes/notes/class-wc-stripe-upe-availability-note.php +++ b/includes/notes/class-wc-stripe-upe-availability-note.php @@ -73,15 +73,10 @@ private static function get_note_class() { public static function init() { /** * No need to display the admin inbox note when - * - UPE preview is disabled * - UPE is already enabled * - UPE has been manually disabled * - Stripe is not enabled */ - if ( ! WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - return; - } - if ( WC_Stripe_Feature_Flags::is_upe_checkout_enabled() ) { return; } diff --git a/includes/payment-methods/class-wc-stripe-payment-request.php b/includes/payment-methods/class-wc-stripe-payment-request.php index 9c5273a632..d8172934f7 100644 --- a/includes/payment-methods/class-wc-stripe-payment-request.php +++ b/includes/payment-methods/class-wc-stripe-payment-request.php @@ -283,10 +283,6 @@ public function get_button_theme() { * @return string */ public function get_button_height() { - if ( ! WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - return isset( $this->stripe_settings['payment_request_button_height'] ) ? str_replace( 'px', '', $this->stripe_settings['payment_request_button_height'] ) : '64'; - } - $height = isset( $this->stripe_settings['payment_request_button_size'] ) ? $this->stripe_settings['payment_request_button_size'] : 'default'; if ( 'small' === $height ) { return '40'; @@ -330,12 +326,7 @@ public function get_button_branded_type() { * @return boolean */ public function is_custom_button() { - // no longer a valid option - if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - return false; - } - - return 'custom' === $this->get_button_type(); + return false; } /** @@ -357,12 +348,7 @@ public function custom_button_selector() { * @return string */ public function get_button_label() { - // no longer a valid option - if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - return ''; - } - - return isset( $this->stripe_settings['payment_request_button_label'] ) ? $this->stripe_settings['payment_request_button_label'] : 'Buy now'; + return ''; } /** @@ -1824,32 +1810,18 @@ public function get_button_settings() { // it would be DRYer to use `array_merge`, // but I thought that this approach might be more straightforward to clean up when we remove the feature flag code. $button_type = $this->get_button_type(); - if ( WC_Stripe_Feature_Flags::is_upe_preview_enabled() ) { - return [ - 'type' => $button_type, - 'theme' => $this->get_button_theme(), - 'height' => $this->get_button_height(), - // Default format is en_US. - 'locale' => apply_filters( 'wc_stripe_payment_request_button_locale', substr( get_locale(), 0, 2 ) ), - 'branded_type' => 'default' === $button_type ? 'short' : 'long', - // these values are no longer applicable - all the JS relying on them can be removed. - 'css_selector' => '', - 'label' => '', - 'is_custom' => false, - 'is_branded' => false, - ]; - } - return [ 'type' => $button_type, 'theme' => $this->get_button_theme(), 'height' => $this->get_button_height(), - 'locale' => apply_filters( 'wc_stripe_payment_request_button_locale', substr( get_locale(), 0, 2 ) ), // Default format is en_US. - 'is_custom' => $this->is_custom_button(), - 'is_branded' => $this->is_branded_button(), - 'css_selector' => $this->custom_button_selector(), - 'branded_type' => $this->get_button_branded_type(), + 'locale' => apply_filters( 'wc_stripe_payment_request_button_locale', substr( get_locale(), 0, 2 ) ), + 'branded_type' => 'default' === $button_type ? 'short' : 'long', + // these values are no longer applicable - all the JS relying on them can be removed. + 'css_selector' => '', + 'label' => '', + 'is_custom' => false, + 'is_branded' => false, ]; } diff --git a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php index e8caee5e03..523b0a5a07 100644 --- a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php +++ b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php @@ -248,7 +248,7 @@ public function __construct() { $this->statement_descriptor = ! empty( $main_settings['statement_descriptor'] ) ? $main_settings['statement_descriptor'] : ''; // When feature flags are enabled, title shows the count of enabled payment methods in settings page only. - 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'] ) { + if ( WC_Stripe_Feature_Flags::is_upe_checkout_enabled() && isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && isset( $_GET['tab'] ) && 'checkout' === $_GET['tab'] ) { $enabled_payment_methods_count = count( $enabled_payment_methods ); $this->title = $enabled_payment_methods_count ? /* translators: $1. Count of enabled payment methods. */ diff --git a/readme.txt b/readme.txt index 14e37602fa..b71e0cfd19 100644 --- a/readme.txt +++ b/readme.txt @@ -116,6 +116,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o * Fix - Ensure Amazon Pay, Apple Pay, and Google Pay display settings are managed correctly * Dev - Add logging with DNS resolution diagnostics for URL validation issues when calling Stripe API * Fix - Allow payment methods to be disabled when they are not available +* Dev - Removes the `_wcstripe_feature_upe` feature flag and the related method from the `WC_Stripe_Feature_Flags` class * Dev - Fixes some incorrect subscriptions support implementations for payment methods [See changelog for full details across versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt). diff --git a/tests/phpunit/WC_Stripe_Helper_Test.php b/tests/phpunit/WC_Stripe_Helper_Test.php index 37e7db4394..3f4c0eb41f 100644 --- a/tests/phpunit/WC_Stripe_Helper_Test.php +++ b/tests/phpunit/WC_Stripe_Helper_Test.php @@ -799,22 +799,6 @@ public function statement_descriptor_sanitation_provider() { ]; } - 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() { - $this->upe_helper->enable_upe_feature_flag(); - - $stripe_settings = WC_Stripe_Helper::get_stripe_settings(); - $this->assertEquals( 'no', $stripe_settings['enabled'] ); - $this->assertEquals( 'no', $stripe_settings['upe_checkout_experience_enabled'] ); - - $stripe_settings['upe_checkout_experience_enabled'] = 'yes'; - WC_Stripe_Helper::update_main_stripe_settings( $stripe_settings ); - - $stripe_settings = WC_Stripe_Helper::get_stripe_settings(); - // Because no Stripe LPM's were enabled when UPE was enabled, the Stripe gateway is not enabled yet. - $this->assertEquals( 'no', $stripe_settings['enabled'] ); - $this->assertEquals( 'yes', $stripe_settings['upe_checkout_experience_enabled'] ); - } - public function test_turning_on_upe_enables_the_correct_upe_methods_based_on_which_legacy_payment_methods_were_enabled() { update_option( 'woocommerce_currency', 'EUR' ); $this->upe_helper->enable_upe_feature_flag();