Automattic\WooCommerce\Internal\AbilitiesApi

AbilitiesClient::enable │ public static │ WC 1.0

Enable the WordPress Abilities API client for admin pages.

This is the main method external plugins should use to enable the abilities API JavaScript client.

Method of the class: AbilitiesClient{}

No Hooks.

Returns

bool. True if successfully enabled, false otherwise.

Usage

$result = AbilitiesClient::enable(): bool;

AbilitiesClient::enable() code WC 11.1.2

public static function enable(): bool {
	// Only enable once.
	if ( self::$enabled ) {
		return true;
	}

	// Hook into admin_enqueue_scripts to enqueue when needed.
	add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_for_admin' ) );

	self::$enabled = true;
	return true;
}