Automattic\WooCommerce\Internal\Features

FeaturesController::feature_is_enabled()publicWC 1.0

Check if a given feature is currently enabled.

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

Хуков нет.

Возвращает

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

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

$FeaturesController = new FeaturesController();
$FeaturesController->feature_is_enabled( $feature_id ): bool;
$feature_id(строка) (обязательный)
Unique feature id.

Код 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 );
}