diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-notices.php b/plugins/woocommerce/includes/admin/class-wc-admin-notices.php
index 55361d2fa5d..971cf0bce70 100644
--- a/plugins/woocommerce/includes/admin/class-wc-admin-notices.php
+++ b/plugins/woocommerce/includes/admin/class-wc-admin-notices.php
@@ -7,6 +7,7 @@
*/
use Automattic\Jetpack\Constants;
+use Automattic\WooCommerce\Internal\Traits\AccessiblePrivateMethods;
use Automattic\WooCommerce\Internal\Utilities\Users;
defined( 'ABSPATH' ) || exit;
@@ -16,6 +17,8 @@ defined( 'ABSPATH' ) || exit;
*/
class WC_Admin_Notices {
+ use AccessiblePrivateMethods;
+
/**
* Stores notices.
*
@@ -53,6 +56,7 @@ class WC_Admin_Notices {
add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) );
add_action( 'wp_loaded', array( __CLASS__, 'add_redirect_download_method_notice' ) );
add_action( 'admin_init', array( __CLASS__, 'hide_notices' ), 20 );
+ self::add_action( 'admin_init', array( __CLASS__, 'maybe_remove_legacy_api_removal_notice' ), 20 );
// @TODO: This prevents Action Scheduler async jobs from storing empty list of notices during WC installation.
// That could lead to OBW not starting and 'Run setup wizard' notice not appearing in WP admin, which we want
@@ -115,6 +119,46 @@ class WC_Admin_Notices {
self::add_notice( 'template_files' );
self::add_min_version_notice();
self::add_maxmind_missing_license_key_notice();
+ self::maybe_add_legacy_api_removal_notice();
+ }
+
+ /**
+ * Add an admin notice about the removal of the Legacy REST API if the said API is enabled.
+ *
+ * TODO: Remove this method in WooCommerce 9.0.
+ */
+ private static function maybe_add_legacy_api_removal_notice() {
+ if ( 'yes' !== get_option( 'woocommerce_api_enabled' ) ) {
+ return;
+ }
+
+ self::add_custom_notice(
+ 'legacy_api_removed_in_woo_90',
+ sprintf(
+ '%s%s',
+ sprintf(
+ '
%s
',
+ esc_html__( 'WooCommerce Legacy API to be removed soon', 'woocommerce' )
+ ),
+ sprintf(
+ // translators: Placeholders are URLs.
+ wpautop( wp_kses_data( __( 'The WooCommerce Legacy REST API, currently enabled in this site, will be removed in WooCommerce 9.0. A separate WooCommerce extension will be available to re-enable it. Learn more about this change', 'woocommerce' ) ) ),
+ admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=legacy_api' ),
+ 'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
+ )
+ )
+ );
+ }
+
+ /**
+ * Remove the admin notice about the removal of the Legacy REST API if the said API is disabled.
+ *
+ * TODO: Remove this method in WooCommerce 9.0.
+ */
+ private static function maybe_remove_legacy_api_removal_notice() {
+ if ( 'yes' !== get_option( 'woocommerce_api_enabled' ) && self::has_notice( 'legacy_api_removed_in_woo_90' ) ) {
+ self::remove_notice( 'legacy_api_removed_in_woo_90' );
+ }
}
/**
@@ -424,7 +468,7 @@ class WC_Admin_Notices {
/**
* Notice about WordPress and PHP minimum requirements.
- *
+ *
* @deprecated 8.2.0 WordPress and PHP minimum requirements notices are no longer shown.
*
* @since 3.6.5
diff --git a/plugins/woocommerce/includes/admin/settings/class-wc-settings-advanced.php b/plugins/woocommerce/includes/admin/settings/class-wc-settings-advanced.php
index f8469783122..bd70f2957c8 100644
--- a/plugins/woocommerce/includes/admin/settings/class-wc-settings-advanced.php
+++ b/plugins/woocommerce/includes/admin/settings/class-wc-settings-advanced.php
@@ -392,11 +392,19 @@ class WC_Settings_Advanced extends WC_Settings_Page {
'id' => 'legacy_api_options',
),
array(
- 'title' => __( 'Legacy API', 'woocommerce' ),
- 'desc' => __( 'Enable the legacy REST API', 'woocommerce' ),
- 'id' => 'woocommerce_api_enabled',
- 'type' => 'checkbox',
- 'default' => 'no',
+ 'title' => __( 'Legacy API', 'woocommerce' ),
+ 'desc' => __( 'Enable the legacy REST API', 'woocommerce' ),
+ 'id' => 'woocommerce_api_enabled',
+ 'type' => 'checkbox',
+ 'default' => 'no',
+ 'desc_tip' => sprintf(
+ // translators: Placeholder is a URL.
+ __(
+ '⚠️ The Legacy REST API will be removed in WooCommerce 9.0. A separate WooCommerce extension will be available to re-enable it. Learn more about this change',
+ 'woocommerce'
+ ),
+ 'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
+ ),
),
array(
'type' => 'sectionend',