@@ -32,6 +32,7 @@ public function __construct() {
32
32
add_action ( 'admin_notices ' , [ $ this , 'admin_notices ' ] );
33
33
add_action ( 'wp_loaded ' , [ $ this , 'hide_notices ' ] );
34
34
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 );
35
36
}
36
37
37
38
/**
@@ -95,6 +96,59 @@ public function admin_notices() {
95
96
}
96
97
}
97
98
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§ion=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
+
98
152
/**
99
153
* List of available payment methods.
100
154
*
@@ -125,22 +179,23 @@ public function get_payment_methods() {
125
179
* @version 4.0.0
126
180
*/
127
181
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 ' ];
144
199
145
200
if ( isset ( $ options ['enabled ' ] ) && 'yes ' === $ options ['enabled ' ] ) {
146
201
// Check if Stripe is in test mode.
@@ -314,6 +369,23 @@ public function stripe_check_environment() {
314
369
315
370
$ this ->add_admin_notice ( 'changed_keys ' , 'notice notice-warning ' , $ message , true );
316
371
}
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
+ }
317
389
}
318
390
}
319
391
@@ -480,6 +552,9 @@ public function hide_notices() {
480
552
case 'changed_keys ' :
481
553
update_option ( 'wc_stripe_show_changed_keys_notice ' , 'no ' );
482
554
break ;
555
+ case 'legacy_deprecation ' :
556
+ update_option ( 'wc_stripe_show_legacy_deprecation_notice ' , 'no ' );
557
+ break ;
483
558
case 'payment_methods ' :
484
559
update_option ( 'wc_stripe_show_payment_methods_notice ' , 'no ' );
485
560
break ;
0 commit comments