This command allows you to manage feature flags via command line. Feature flags enable or disable specific features in PrestaShop, allowing for gradual rollout of new functionality or A/B testing.
php bin/console prestashop:feature-flag <action> [feature_flag]
enable, disable, listenable and disable actions)Display all available feature flags with their current state:
php bin/console prestashop:feature-flag list
Output example:
--------------- ------------------ ----------
Feature flag Type State
--------------- ------------------ ----------
feature_x [dotenv],env,db Enabled
feature_y dotenv,[env],db Disabled
--------------- ------------------ ----------
The Type column shows the configuration sources in order of priority. The currently active type is shown in brackets [type].
Enable a specific feature flag:
php bin/console prestashop:feature-flag enable <feature_flag_name>
Example:
php bin/console prestashop:feature-flag enable feature_x
# Output: Feature flag feature_x was enabled
Disable a specific feature flag:
php bin/console prestashop:feature-flag disable <feature_flag_name>
Example:
php bin/console prestashop:feature-flag disable feature_x
# Output: Feature flag feature_x was disabled
Feature flags can be configured through multiple sources (in order of priority):
.env file configurationThe command will modify the appropriate source based on the feature flag’s configuration.
The command will display an error if:
enable, disable, list