Automattic\WooCommerce\Utilities

FeaturesUtil::declare_compatibilitypublic staticWC 1.0

Declare (in)compatibility with a given feature for a given plugin.

This method MUST be executed from inside a handler for the before_woocommerce_init and SHOULD be executed from the main plugin file passing __FILE__ or 'my-plugin/my-plugin.php' for the $plugin_file argument.

Method of the class: FeaturesUtil{}

No Hooks.

Returns

true|false. True on success, false on error (feature doesn't exist or not inside the required hook).

Usage

$result = FeaturesUtil::declare_compatibility( $feature_id, $plugin_file, $positive_compatibility ): bool;
$feature_id(string) (required)
Unique feature id.
$plugin_file(string) (required)
The full plugin file path.
$positive_compatibility(true|false)
True if the plugin declares being compatible with the feature, false if it declares being incompatible.
Default: true

FeaturesUtil::declare_compatibility() code WC 10.8.1

public static function declare_compatibility( string $feature_id, string $plugin_file, bool $positive_compatibility = true ): bool {
	return wc_get_container()->get( FeaturesController::class )->declare_compatibility(
		$feature_id,
		$plugin_file,
		$positive_compatibility
	);
}