Automattic\WooCommerce\Utilities

PluginUtil::is_woocommerce_aware_plugin()publicWC 1.0

Check if a plugin is WooCommerce aware.

Method of the class: PluginUtil{}

No Hooks.

Return

true|false. True if the plugin exists and is WooCommerce aware.

Usage

$PluginUtil = new PluginUtil();
$PluginUtil->is_woocommerce_aware_plugin( $plugin_file_or_data ): bool;
$plugin_file_or_data(string|array) (required)
Plugin id (path/file.php) or plugin data (as returned by get_plugins).

PluginUtil::is_woocommerce_aware_plugin() code WC 7.1.0

public function is_woocommerce_aware_plugin( $plugin_file_or_data ): bool {
	if ( is_string( $plugin_file_or_data ) ) {
		return in_array( $plugin_file_or_data, $this->get_woocommerce_aware_plugins(), true );
	} elseif ( is_array( $plugin_file_or_data ) ) {
		return '' !== ArrayUtil::get_value_or_default( $plugin_file_or_data, 'WC tested up to', '' );
	} else {
		throw new \Exception( 'is_woocommerce_aware_plugin requires a plugin name or an array of plugin data as input' );
	}
}