WC_Admin_Notices::maybe_remove_legacy_api_removal_notice()private staticWC 1.0

Remove the admin notice about the removal of the Legacy REST API if the said API is disabled or if the Legacy REST API extension is installed, and remove the notice about Legacy webhooks if no such webhooks exist anymore or if the Legacy REST API extension is installed.

TODO: Change this method in WooCommerce 9.0 so that the notice get removed if the Legacy REST API extension is installed and active.

Method of the class: WC_Admin_Notices{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Admin_Notices::maybe_remove_legacy_api_removal_notice();

WC_Admin_Notices::maybe_remove_legacy_api_removal_notice() code WC 8.9.0

private static function maybe_remove_legacy_api_removal_notice() {
	$plugin_is_active = is_plugin_active( 'woocommerce-legacy-rest-api/woocommerce-legacy-rest-api.php' );

	if ( self::has_notice( 'legacy_api_removed_in_woo_90' ) && ( $plugin_is_active || 'yes' !== get_option( 'woocommerce_api_enabled' ) ) ) {
		self::remove_notice( 'legacy_api_removed_in_woo_90' );
	}

	if ( self::has_notice( 'legacy_webhooks_unsupported_in_woo_90' ) && ( $plugin_is_active || 0 === wc_get_container()->get( WebhookUtil::class )->get_legacy_webhooks_count() ) ) {
		self::remove_notice( 'legacy_webhooks_unsupported_in_woo_90' );
	}

	if ( self::has_notice( 'legacy_rest_api_is_incompatible_with_hpos' ) &&
		! ( 'yes' === get_option( 'woocommerce_api_enabled' ) && 'yes' === get_option( CustomOrdersTableController::CUSTOM_ORDERS_TABLE_USAGE_ENABLED_OPTION ) ) ) {
		self::remove_notice( 'legacy_rest_api_is_incompatible_with_hpos' );
	}
}