FeaturesController::change_feature_enable()publicWC 1.0

Change the enabled/disabled status of a feature.

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

Хуков нет.


true|false. True on success, false if feature doesn't exist or the new value is the same as the old value.


$FeaturesController = new FeaturesController();
$FeaturesController->change_feature_enable( $feature_id, $enable ): bool;
$feature_id(строка) (обязательный)
Unique feature id.
$enable(true|false) (обязательный)
True to enable the feature, false to disable it.

Код FeaturesController::change_feature_enable() WC 8.5.2

public function change_feature_enable( string $feature_id, bool $enable ): bool {
	if ( ! $this->feature_exists( $feature_id ) ) {
		return false;

	return update_option( $this->feature_enable_option_name( $feature_id ), $enable ? 'yes' : 'no' );