WC_Admin_Notices::maybe_add_php73_required_notice()private staticWC 1.0

Add an admin notice about the removal of the Legacy REST API if the said API is enabled, and a notice about soon to be unsupported webhooks with Legacy API payload if at least one of these exist.

TODO: Change this method in WooCommerce 9.0 so that it checks if the Legacy REST API extension is installed, and if not, it points to the extension URL in the WordPress plugins directory.

Method of the class: WC_Admin_Notices{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Admin_Notices::maybe_add_legacy_api_removal_notice();

WC_Admin_Notices::maybe_add_php73_required_notice() code WC 8.7.0

private static function maybe_add_legacy_api_removal_notice() {
	if ( is_plugin_active( 'woocommerce-legacy-rest-api/woocommerce-legacy-rest-api.php' ) ) {
		return;
	}

	if ( 'yes' === get_option( 'woocommerce_api_enabled' ) ) {
		self::add_custom_notice(
			'legacy_api_removed_in_woo_90',
			sprintf(
				'%s%s',
				sprintf(
					'<h4>%s</h4>',
					esc_html__( 'The WooCommerce Legacy REST API will be removed soon', 'woocommerce' )
				),
				sprintf(
				// translators: Placeholders are URLs.
					wpautop( __( 'The WooCommerce Legacy REST API, <a href="%1$s">currently enabled in this site</a>, will be removed in WooCommerce 9.0. <a target="_blank" href="%2$s">A separate WooCommerce extension is available</a> to keep it enabled. <b><a target="_blank" href="%3$s">Learn more about this change.</a></b>', 'woocommerce' ) ),
					admin_url( 'admin.php?page=wc-settings&tab=advanced&section=legacy_api' ),
					'https://wordpress.org/plugins/woocommerce-legacy-rest-api/',
					'https://developer.woo.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
				)