WC_Admin_Notices::maybe_add_legacy_api_removal_notice()private staticWC 1.0

Add an admin notice about unsupported webhooks with Legacy API payload if at least one of these exist and the Legacy REST API plugin is not installed.

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_legacy_api_removal_notice() code WC 9.7.1

private static function maybe_add_legacy_api_removal_notice() {
	if ( wc_get_container()->get( WebhookUtil::class )->get_legacy_webhooks_count() > 0 && ! WC()->legacy_rest_api_is_available() ) {
		self::add_custom_notice(
			'legacy_webhooks_unsupported_in_woo_90',
			sprintf(
				'%s%s',
				sprintf(
					'<h4>%s</h4>',
					esc_html__( 'WooCommerce webhooks that use the Legacy REST API are unsupported', 'woocommerce' )
				),
				sprintf(
				// translators: Placeholders are URLs.
					wpautop( __( '⚠️ The WooCommerce Legacy REST API has been removed from WooCommerce, this will cause <a href="%1$s">webhooks on this site that are configured to use the Legacy REST API</a> to stop working. <a target="_blank" href="%2$s">A separate WooCommerce extension is available</a> to allow these webhooks to keep using the Legacy REST API without interruption. You can also edit these webhooks to use the current REST API version to generate the payload instead. <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=webhooks&legacy=true' ),
					'https://wordpress.org/plugins/woocommerce-legacy-rest-api/',
					'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
				)
			)
		);
	}
}