Automattic\WooCommerce\Internal\Features

FeaturesController::feature_is_enabled()publicWC 1.0

Check if a given feature is currently enabled.

Method of the class: 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.

FeaturesController::feature_is_enabled() code WC 8.7.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';
	$value         = 'yes' === get_option( $this->feature_enable_option_name( $feature_id ), $default_value );
	return $value;
}