woocommerce_blocks_plugin_outdated_notice()WC 1.0

Add notice to the admin dashboard if the plugin is outdated.

Хуков нет.

Возвращает

null. Ничего.

Использование

woocommerce_blocks_plugin_outdated_notice();

Заметки

Код woocommerce_blocks_plugin_outdated_notice() WC 6.9.4

<?php
function woocommerce_blocks_plugin_outdated_notice() {
	$is_active =
		is_plugin_active( 'woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ||
		is_plugin_active( 'woocommerce-gutenberg-products-block/woocommerce-gutenberg-products-block.php' ) ||
		is_plugin_active( 'woocommerce-blocks/woocommerce-gutenberg-products-block.php' );

	if ( ! $is_active ) {
		return;
	}

	$woocommerce_blocks_path = \Automattic\WooCommerce\Blocks\Package::get_path();

	/**
	 * Check the current WC Blocks path. If the WC Blocks plugin is active but
	 * the current path is from the WC Core, we can consider the plugin is
	 * outdated because Jetpack Autoloader always loads the newer package.
	 */
	if ( ! strpos( $woocommerce_blocks_path, 'packages/woocommerce-blocks' ) ) {
		return;
	}

	if ( should_display_compatibility_notices() ) {
		?>
		<div class="notice notice-warning">
			<p><?php esc_html_e( 'You have WooCommerce Blocks installed, but the WooCommerce bundled version is running because it is more up-to-date. This may cause unexpected compatibility issues. Please update the WooCommerce Blocks plugin.', 'woocommerce' ); ?></p>
		</div>
		<?php
	}
}