Automattic\WooCommerce\Internal\Features
FeaturesController::init_feature_definitions │ private │ WC 1.0
Initialize the hardcoded feature definitions array. This doesn't include:
- Features that get initialized via the (deprecated) woocommerce_register_feature_definitions.
- Features whose definition comes from another class. These are initialized directly in get_feature_definitions to avoid circular calls in the dependency injection container.
Method of the class: FeaturesController{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->init_feature_definitions(): void;
FeaturesController::init_feature_definitions() FeaturesController::init feature definitions code WC 10.5.0
private function init_feature_definitions(): void {
$alpha_feature_testing_is_enabled = Constants::is_true( 'WOOCOMMERCE_ENABLE_ALPHA_FEATURE_TESTING' );
$tracking_enabled = WC_Site_Tracking::is_tracking_enabled();
$legacy_features = array(
'analytics' => array(
'name' => __( 'Analytics', 'woocommerce' ),
'description' => __( 'Enable WooCommerce Analytics', 'woocommerce' ),
'option_key' => Analytics::TOGGLE_OPTION_NAME,
'is_experimental' => false,
'enabled_by_default' => true,
'disable_ui' => false,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
'product_block_editor' => array(
'name' => __( 'New product editor', 'woocommerce' ),
'description' => __( 'Try the new product editor (Beta)', 'woocommerce' ),
'is_experimental' => true,
'disable_ui' => false,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
'cart_checkout_blocks' => array(
'name' => __( 'Cart & Checkout Blocks', 'woocommerce' ),
'description' => __( 'Optimize for faster checkout', 'woocommerce' ),
'is_experimental' => false,
'disable_ui' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
'rate_limit_checkout' => array(
'name' => __( 'Rate limit Checkout', 'woocommerce' ),
'description' => sprintf(
// translators: %s is the URL to the rate limiting documentation.
__( 'Enables rate limiting for Checkout place order and Store API /checkout endpoint. To further control this, refer to <a href="%s" target="_blank">rate limiting documentation</a>.', 'woocommerce' ),
'https://developer.woocommerce.com/docs/apis/store-api/rate-limiting/'
),
'is_experimental' => false,
'disable_ui' => false,
'enabled_by_default' => false,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
'marketplace' => array(
'name' => __( 'Marketplace', 'woocommerce' ),
'description' => __(
'New, faster way to find extensions and themes for your WooCommerce store',
'woocommerce'
),
'is_experimental' => false,
'enabled_by_default' => true,
'disable_ui' => true,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'deprecated_since' => '10.5.0',
'deprecated_value' => true,
),
// Marked as a legacy feature to avoid compatibility checks, which aren't really relevant to this feature.
// https://github.com/woocommerce/woocommerce/pull/39701#discussion_r1376976959.
'order_attribution' => array(
'name' => __( 'Order Attribution', 'woocommerce' ),
'description' => __(
'Enable this feature to track and credit channels and campaigns that contribute to orders on your site',
'woocommerce'
),
'enabled_by_default' => true,
'disable_ui' => false,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'is_experimental' => false,
),
'site_visibility_badge' => array(
'name' => __( 'Site visibility badge', 'woocommerce' ),
'description' => __(
'Enable the site visibility badge in the WordPress admin bar',
'woocommerce'
),
'enabled_by_default' => true,
'disable_ui' => false,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'is_experimental' => false,
'disabled' => false,
),
'hpos_fts_indexes' => array(
'name' => __( 'HPOS Full text search indexes', 'woocommerce' ),
'description' => __(
'Create and use full text search indexes for orders. This feature only works with high-performance order storage.',
'woocommerce'
),
'is_experimental' => true,
'enabled_by_default' => false,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'option_key' => CustomOrdersTableController::HPOS_FTS_INDEX_OPTION,
),
'hpos_datastore_caching' => array(
'name' => __( 'HPOS Data Caching', 'woocommerce' ),
'description' => __(
'Enable order data caching in the datastore. This feature only works with high-performance order storage and is recommended for stores using object caching.',
'woocommerce'
),
'is_experimental' => false,
'enabled_by_default' => false,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'disable_ui' => false,
'option_key' => CustomOrdersTableController::HPOS_DATASTORE_CACHING_ENABLED_OPTION,
),
'remote_logging' => array(
'name' => __( 'Remote Logging', 'woocommerce' ),
'description' => sprintf(
/* translators: %1$s: opening link tag, %2$s: closing link tag */
__( 'Allow WooCommerce to send error logs and non-sensitive diagnostic data to help improve WooCommerce. This feature requires %1$susage tracking%2$s to be enabled.', 'woocommerce' ),
'<a href="' . admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=woocommerce_com' ) . '">',
'</a>'
),
'enabled_by_default' => true,
'disable_ui' => false,
/*
* This is not truly a legacy feature (it is not a feature that pre-dates the FeaturesController),
* but we wish to handle compatibility checking in a similar fashion to legacy features. The
* rational for setting legacy to true is therefore similar to that of the 'order_attribution'
* feature.
*
* @see https://github.com/woocommerce/woocommerce/pull/39701#discussion_r1376976959
*/
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'is_experimental' => false,
'setting' => array(
'disabled' => function () use ( $tracking_enabled ) {
return ! $tracking_enabled;
},
'desc_tip' => function () use ( $tracking_enabled ) {
if ( ! $tracking_enabled ) {
return __( '⚠ Usage tracking must be enabled to use remote logging.', 'woocommerce' );
}
return '';
},
),
),
'email_improvements' => array(
'name' => __( 'Email improvements', 'woocommerce' ),
'description' => __(
'Enable modern email design for transactional emails',
'woocommerce'
),
/*
* This is not truly a legacy feature (it is not a feature that pre-dates the FeaturesController),
* but as this feature doesn't affect all extensions, and the rollout is fairly short,
* we'll skip the compatibility check by marking this as legacy. This is a workaround until
* we can implement a more sophisticated compatibility checking system.
*
* @see https://github.com/woocommerce/woocommerce/issues/39147
* @see https://github.com/woocommerce/woocommerce/issues/55540
*/
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'is_experimental' => false,
),
'blueprint' => array(
'name' => __( 'Blueprint (beta)', 'woocommerce' ),
'description' => __(
'Enable blueprint to import and export settings in bulk',
'woocommerce'
),
'enabled_by_default' => true,
'disable_ui' => false,
/*
* This is not truly a legacy feature (it is not a feature that pre-dates the FeaturesController),
* but we wish to handle compatibility checking in a similar fashion to legacy features. The
* rational for setting legacy to true is therefore similar to that of the 'order_attribution'
* feature.
*
* @see https://github.com/woocommerce/woocommerce/pull/39701#discussion_r1376976959
*/
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'is_experimental' => false,
),
'block_email_editor' => array(
'name' => __( 'Block Email Editor (alpha)', 'woocommerce' ),
'description' => __(
'Enable the block-based email editor for transactional emails.',
'woocommerce'
),
'learn_more_url' => 'https://github.com/woocommerce/woocommerce/discussions/52897#discussioncomment-11630256',
/*
* This is not truly a legacy feature (it is not a feature that pre-dates the FeaturesController),
* but we wish to handle compatibility checking in a similar fashion to legacy features. The
* rational for setting legacy to true is therefore similar to that of the 'order_attribution'
* feature.
*
* @see https://github.com/woocommerce/woocommerce/pull/39701#discussion_r1376976959
*/
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'enabled_by_default' => false,
),
'point_of_sale' => array(
'name' => __( 'Point of Sale', 'woocommerce' ),
'description' => __(
'Enable Point of Sale functionality in the WooCommerce mobile apps.',
'woocommerce'
),
'enabled_by_default' => true,
'disable_ui' => false,
/*
* This is not truly a legacy feature (it is not a feature that pre-dates the FeaturesController),
* but we wish to handle compatibility checking in a similar fashion to legacy features. The
* rational for setting legacy to true is therefore similar to that of the 'order_attribution'
* feature.
*
* @see https://github.com/woocommerce/woocommerce/pull/39701#discussion_r1376976959
*/
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'is_experimental' => true,
),
'fulfillments' => array(
'name' => __( 'Order Fulfillments', 'woocommerce' ),
'description' => __(
'Enable the Order Fulfillments feature to manage order fulfillment and shipping.',
'woocommerce'
),
'enabled_by_default' => false,
'disable_ui' => true,
'is_experimental' => false,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
'mcp_integration' => array(
'name' => __( 'WooCommerce MCP', 'woocommerce' ),
'description' => $this->get_mcp_integration_description(),
'enabled_by_default' => false,
'disable_ui' => false,
'is_experimental' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
'is_legacy' => false,
),
'destroy-empty-sessions' => array(
'name' => __( 'Clear Customer Sessions When Empty', 'woocommerce' ),
'description' => __(
'[Performance] Removes session cookies for non-logged in customers when session data is empty, improving page caching performance. May cause compatibility issues with extensions that depend on the session cookie without using session data.',
'woocommerce'
),
'enabled_by_default' => false,
'is_experimental' => true,
'disable_ui' => false,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
'agentic_checkout' => array(
'name' => __( 'Agentic Checkout API', 'woocommerce' ),
'description' => __(
'Enable the Agentic Checkout API for AI-powered checkout experiences (e.g., ChatGPT). This adds REST API endpoints that allow AI agents to create and manage checkout sessions.',
'woocommerce'
),
'enabled_by_default' => false,
'is_experimental' => true,
'disable_ui' => true,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
PushNotifications::FEATURE_NAME => array(
'name' => __( 'Push Notifications', 'woocommerce' ),
'description' => __(
'Enable push notifications for the WooCommerce mobile apps to receive order notifications and store updates.',
'woocommerce'
),
'enabled_by_default' => false,
'is_experimental' => true,
'disable_ui' => true,
'skip_compatibility_checks' => false,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
'rest_api_caching' => array(
'name' => __( 'REST API Caching', 'woocommerce' ),
'description' => sprintf(
/* translators: %1$s and %2$s are opening and closing <a> tags */
__( 'Enable backend caching and cache control headers for REST API responses via the <code>RestApiCache</code> trait. ⚙️ %1$sConfiguration%2$s', 'woocommerce' ),
'<a href="' . admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=rest_api_caching' ) . '">',
'</a>'
),
'enabled_by_default' => false,
'is_experimental' => true,
'disable_ui' => false,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
ProductCacheController::FEATURE_NAME => array(
'name' => __( 'Cache Product Objects', 'woocommerce' ),
'description' => __(
'[Performance] Speeds up your store by caching product objects during each request, preventing duplicate product loads. Can improve page load times on product-heavy pages.',
'woocommerce'
),
'default_plugin_compatibility' => FeaturePluginCompatibility::INCOMPATIBLE,
'enabled_by_default' => false,
'is_experimental' => true,
'disable_ui' => false,
),
'fraud_protection' => array(
'name' => __( 'Fraud protection', 'woocommerce' ),
'description' => __(
'Enable fraud protection features for your store.',
'woocommerce'
),
'enabled_by_default' => false,
'disable_ui' => true,
'is_experimental' => true,
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
);
if ( ! $tracking_enabled ) {
// Uncheck the remote logging feature when usage tracking is disabled.
$legacy_features['remote_logging']['setting']['value'] = 'no';
}
foreach ( $legacy_features as $slug => $definition ) {
$this->add_feature_definition( $slug, $definition['name'], $definition );
}
$this->init_compatibility_info_by_feature();
}