Automattic\WooCommerce\Internal\Features

FeaturesController::feature_is_enabled()publicWC 1.0

Check if a given feature is currently enabled.

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

No Hooks.

Return

true|false. True if the feature is enabled, false if not or if the feature doesn't exist.

Usage

$FeaturesController = new FeaturesController();
$FeaturesController->feature_is_enabled( $feature_id ): bool;
$feature_id(string) (required)
Unique feature id.

Code of FeaturesController::feature_is_enabled() WC 7.1.0

public function feature_is_enabled( string $feature_id ): bool {
	if ( ! $this->feature_exists( $feature_id ) ) {
		return false;
	}

	$default_value = $this->feature_is_enabled_by_default( $feature_id ) ? 'yes' : 'no';
	return 'yes' === get_option( $this->feature_enable_option_name( $feature_id ), $default_value );
}