Automattic\WooCommerce\Internal\Features
FeaturesController::change_feature_enable
Change the enabled/disabled status of a feature.
Method of the class: FeaturesController{}
No Hooks.
Returns
true|false. True on success, false if feature doesn't exist or the new value is the same as the old value.
Usage
$FeaturesController = new FeaturesController(); $FeaturesController->change_feature_enable( $feature_id, $enable ): bool;
- $feature_id(string) (required)
- Unique feature id.
- $enable(true|false) (required)
- True to enable the feature, false to disable it.
FeaturesController::change_feature_enable() FeaturesController::change feature enable code WC 10.8.1
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', 'on' );
}