Automattic\WooCommerce\Internal\Features
FeaturesController::feature_is_enabled
Check if a given feature is currently enabled.
Method of the class: FeaturesController{}
No Hooks.
Returns
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() FeaturesController::feature is enabled code WC 10.3.3
public function feature_is_enabled( string $feature_id ): bool {
if ( ! $this->feature_exists( $feature_id ) ) {
return false;
}
if ( $this->is_preview_email_improvements_enabled( $feature_id ) ) {
return true;
}
$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;
}