Skip to content

Commit 5500037

Browse files
Mayishadiegocurbelo
andcommitted
Add legacy deprecation notice (#4050)
* add admin notice about legacy deprecation * show notice on plugin page * Update legacy deprecation message * Hide the legacy checkout notice in the plugin list if the new checkout is enabled --------- Co-authored-by: Diego Curbelo <[email protected]>
1 parent 2d3ea34 commit 5500037

File tree

3 files changed

+93
-16
lines changed

3 files changed

+93
-16
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* Tweak - Fix background in express checkout settings.
4343
* Fix - Prevent potential duplicate renewal charges by ensuring subscription integration hooks are only attached once per Gateway ID
4444
* Update - Update Amazon Pay icon to use image from WooCommerce Design Library.
45+
* Add - Show upcoming legacy checkout experience deprecation notice.
4546

4647
= 9.2.0 - 2025-02-13 =
4748
* Fix - Fix missing product_id parameter for the express checkout add-to-cart operation.

includes/admin/class-wc-stripe-admin-notices.php

Lines changed: 91 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function __construct() {
3232
add_action( 'admin_notices', [ $this, 'admin_notices' ] );
3333
add_action( 'wp_loaded', [ $this, 'hide_notices' ] );
3434
add_action( 'woocommerce_stripe_updated', [ $this, 'stripe_updated' ] );
35+
add_action( 'after_plugin_row_woocommerce-gateway-stripe/woocommerce-gateway-stripe.php', [ $this, 'display_legacy_deprecation_notice' ], 10, 1 );
3536
}
3637

3738
/**
@@ -95,6 +96,59 @@ public function admin_notices() {
9596
}
9697
}
9798

99+
/**
100+
* Displays the legacy deprecation notice.
101+
*
102+
* @param string $plugin_file Plugin file.
103+
*/
104+
public static function display_legacy_deprecation_notice( $plugin_file ) {
105+
global $wp_list_table;
106+
107+
if ( version_compare( WC_STRIPE_VERSION, '9.3.0', '!=' ) || WC_Stripe_Feature_Flags::is_upe_checkout_enabled() ) {
108+
return;
109+
}
110+
111+
if ( is_null( $wp_list_table ) ) {
112+
return;
113+
}
114+
115+
$columns_count = $wp_list_table->get_column_count();
116+
$is_active = is_plugin_active( $plugin_file );
117+
$is_active_class = $is_active ? 'active' : 'inactive';
118+
119+
$setting_link = esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe&panel=settings' ) );
120+
$message = sprintf(
121+
/* translators: 1) HTML anchor open tag 2) HTML anchor closing tag */
122+
__( 'WooCommerce Stripe Gateway legacy checkout experience will no longer be supported in a subsequent version of this plugin. Please %1$smigrate to the new checkout experience%2$s to access more payment methods and avoid disruptions. %3$sLearn more%4$s', 'woocommerce-gateway-stripe' ),
123+
'<a href="' . $setting_link . '">',
124+
'</a>',
125+
'<a href="https://woocommerce.com/document/stripe/admin-experience/legacy-checkout-experience/" target="_blank">',
126+
'</a>'
127+
);
128+
129+
?>
130+
<tr class='plugin-update-tr <?php echo esc_html( $is_active_class ); ?>' data-id="woocommerce-gateway-stripe-update" data-slug="woocommerce-gateway-stripe" data-plugin='<?php echo esc_html( $plugin_file ); ?>'>
131+
<td colspan='<?php echo esc_html( $columns_count ); ?>' class='plugin-update colspanchange'>
132+
<div class='notice inline notice-warning notice-alt'>
133+
<p>
134+
<span style="display: inline-block; vertical-align: text-top;">
135+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
136+
<path d="M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z" stroke="#dba617" stroke-width="1.5"/>
137+
<path d="M13 7H11V13H13V7Z" fill="#dba617"/>
138+
<path d="M13 15H11V17H13V15Z" fill="#dba617"/>
139+
</svg>
140+
</span>
141+
<?php
142+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
143+
echo $message;
144+
?>
145+
</p>
146+
</div>
147+
</td>
148+
</tr>
149+
<?php
150+
}
151+
98152
/**
99153
* List of available payment methods.
100154
*
@@ -125,22 +179,23 @@ public function get_payment_methods() {
125179
* @version 4.0.0
126180
*/
127181
public function stripe_check_environment() {
128-
$show_style_notice = get_option( 'wc_stripe_show_style_notice' );
129-
$show_ssl_notice = get_option( 'wc_stripe_show_ssl_notice' );
130-
$show_keys_notice = get_option( 'wc_stripe_show_keys_notice' );
131-
$show_3ds_notice = get_option( 'wc_stripe_show_3ds_notice' );
132-
$show_phpver_notice = get_option( 'wc_stripe_show_phpver_notice' );
133-
$show_wcver_notice = get_option( 'wc_stripe_show_wcver_notice' );
134-
$show_curl_notice = get_option( 'wc_stripe_show_curl_notice' );
135-
$show_sca_notice = get_option( 'wc_stripe_show_sca_notice' );
136-
$changed_keys_notice = get_option( 'wc_stripe_show_changed_keys_notice' );
137-
$options = WC_Stripe_Helper::get_stripe_settings();
138-
$testmode = WC_Stripe_Mode::is_test();
139-
$test_pub_key = isset( $options['test_publishable_key'] ) ? $options['test_publishable_key'] : '';
140-
$test_secret_key = isset( $options['test_secret_key'] ) ? $options['test_secret_key'] : '';
141-
$live_pub_key = isset( $options['publishable_key'] ) ? $options['publishable_key'] : '';
142-
$live_secret_key = isset( $options['secret_key'] ) ? $options['secret_key'] : '';
143-
$three_d_secure = isset( $options['three_d_secure'] ) && 'yes' === $options['three_d_secure'];
182+
$show_style_notice = get_option( 'wc_stripe_show_style_notice' );
183+
$show_ssl_notice = get_option( 'wc_stripe_show_ssl_notice' );
184+
$show_keys_notice = get_option( 'wc_stripe_show_keys_notice' );
185+
$show_3ds_notice = get_option( 'wc_stripe_show_3ds_notice' );
186+
$show_phpver_notice = get_option( 'wc_stripe_show_phpver_notice' );
187+
$show_wcver_notice = get_option( 'wc_stripe_show_wcver_notice' );
188+
$show_curl_notice = get_option( 'wc_stripe_show_curl_notice' );
189+
$show_sca_notice = get_option( 'wc_stripe_show_sca_notice' );
190+
$changed_keys_notice = get_option( 'wc_stripe_show_changed_keys_notice' );
191+
$legacy_deprecation_notice = get_option( 'wc_stripe_show_legacy_deprecation_notice' );
192+
$options = WC_Stripe_Helper::get_stripe_settings();
193+
$testmode = WC_Stripe_Mode::is_test();
194+
$test_pub_key = isset( $options['test_publishable_key'] ) ? $options['test_publishable_key'] : '';
195+
$test_secret_key = isset( $options['test_secret_key'] ) ? $options['test_secret_key'] : '';
196+
$live_pub_key = isset( $options['publishable_key'] ) ? $options['publishable_key'] : '';
197+
$live_secret_key = isset( $options['secret_key'] ) ? $options['secret_key'] : '';
198+
$three_d_secure = isset( $options['three_d_secure'] ) && 'yes' === $options['three_d_secure'];
144199

145200
if ( isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) {
146201
// Check if Stripe is in test mode.
@@ -314,6 +369,23 @@ public function stripe_check_environment() {
314369

315370
$this->add_admin_notice( 'changed_keys', 'notice notice-warning', $message, true );
316371
}
372+
373+
if ( empty( $legacy_deprecation_notice ) ) {
374+
// Show legacy deprecation notice in version 9.3.0 if legacy checkout experience is enabled.
375+
if ( ! WC_Stripe_Feature_Flags::is_upe_checkout_enabled() && version_compare( WC_STRIPE_VERSION, '9.3.0', '==' ) ) {
376+
$setting_link = $this->get_setting_link();
377+
$message = sprintf(
378+
/* translators: 1) HTML anchor open tag 2) HTML anchor closing tag */
379+
__( 'WooCommerce Stripe Gateway legacy checkout experience will no longer be supported in a subsequent version of this plugin. Please %1$smigrate to the new checkout experience%2$s to access more payment methods and avoid disruptions. %3$sLearn more%4$s', 'woocommerce-gateway-stripe' ),
380+
'<a href="' . $setting_link . '">',
381+
'</a>',
382+
'<a href="https://woocommerce.com/document/stripe/admin-experience/legacy-checkout-experience/" target="_blank">',
383+
'</a>'
384+
);
385+
386+
$this->add_admin_notice( 'legacy_deprecation', 'notice notice-warning', $message, true );
387+
}
388+
}
317389
}
318390
}
319391

@@ -480,6 +552,9 @@ public function hide_notices() {
480552
case 'changed_keys':
481553
update_option( 'wc_stripe_show_changed_keys_notice', 'no' );
482554
break;
555+
case 'legacy_deprecation':
556+
update_option( 'wc_stripe_show_legacy_deprecation_notice', 'no' );
557+
break;
483558
case 'payment_methods':
484559
update_option( 'wc_stripe_show_payment_methods_notice', 'no' );
485560
break;

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
152152
* Tweak - Fix background in express checkout settings.
153153
* Fix - Prevent potential duplicate renewal charges by ensuring subscription integration hooks are only attached once per Gateway ID
154154
* Update - Update Amazon Pay icon to use image from WooCommerce Design Library.
155+
* Add - Show upcoming legacy checkout experience deprecation notice.
155156

156157
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

0 commit comments

Comments
 (0)