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.

Метод класса: FeaturesUtil{}

Хуков нет.

Возвращает

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

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

$result = FeaturesUtil::declare_compatibility( $feature_id, $plugin_file, $positive_compatibility ): bool;
$feature_id(строка) (обязательный)
Unique feature id.
$plugin_file(строка) (обязательный)
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.
По умолчанию: true

Код FeaturesUtil::declare_compatibility() WC 11.0.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
	);
}