Commit a7efed0b9f for woocommerce
commit a7efed0b9f345606af7f96b206830914ad1d88e7
Author: Michal Iwanow <4765119+mcliwanow@users.noreply.github.com>
Date: Fri Jan 9 15:32:07 2026 +0100
Deprecate "marketplace" feature flag and remove it's usages where possible. (#62264)
* Add deprecation pattern for feature flags and deprecate marketplace feature flag
Introduce a systematic way to deprecate feature flags:
- Add get_feature_definition() helper method
- Add log_deprecated_feature_usage() for logging and tracking
- Support deprecated_since and deprecated_value properties
- Log warnings and track events when deprecated features are checked
This enables graceful deprecation of features while maintaining backwards compatibility for third-party code.
The marketplace feature has been force-enabled since WC 8.5.0 and the UI to toggle it was removed. Mark it as deprecated with deprecated_value: true so feature_is_enabled('marketplace') continues to return true for backwards compatibility while logging deprecation warnings.
* Remove marketplace force-enable workaround
* Simplify Extensions menu registration
Now that marketplace is always enabled:
- Remove the feature flag conditional
- Always use the Marketplace class for menu registration
- Deprecate addons_menu() method for backwards compatibility
* Remove marketplace feature checks from helper files
Clean up remaining internal references to the marketplace feature flag:
- Update functions (remove from autoload options)
- Helper class (simplify redirect logic)
- Section nav view (always use in-app URL)
* Remove marketplace feature checks from JS components
Now that marketplace is always enabled, remove isFeatureEnabled checks and always use in-app URLs for marketplace CTAs. This removes dead code and simplifies the components.
* Tweaks after review: add since tags, fix indentation, more defensive programming
* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin
* Remove replacement message for marketplace feature removal
* Remove last check for marketplace feature flag
* Remove woocommerce_feature_marketplace_enabled option on upgrade to 10.5
This option won't be needed anymore. No need to keep orphans in DB
* Update changelog message
Co-authored-by: Boro Sitnikovski <buritomath@gmail.com>
* Add changefile(s) from automation for the following project(s): woocommerce, woocommerce/client/admin
* add return type to wc_update_1050_remove_deprecated_marketplace_option
* Do not log deprecation warning when getting all features
* Remove tracking when checking deprecated feature flags
* addons_menu: bring back previous code while keeping deprecation notice
* Update deprecated marketplace option handling for backwards compatibility
* Feature flags: update docblock with deprecation params
* Depreacted marketplace flag - remove from DB as it's not needed anymore
---------
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Boro Sitnikovski <buritomath@gmail.com>
diff --git a/plugins/woocommerce/changelog/62264-wccom-1602-investigate-removing-marketplace-feature-flag-in-core b/plugins/woocommerce/changelog/62264-wccom-1602-investigate-removing-marketplace-feature-flag-in-core
new file mode 100644
index 0000000000..69e9548223
--- /dev/null
+++ b/plugins/woocommerce/changelog/62264-wccom-1602-investigate-removing-marketplace-feature-flag-in-core
@@ -0,0 +1,4 @@
+Significance: minor
+Type: update
+
+Deprecate the marketplace feature flag - the in-app marketplace is now always enabled and the feature check is no longer necessary.
\ No newline at end of file
diff --git a/plugins/woocommerce/client/admin/client/customize-store/index.tsx b/plugins/woocommerce/client/admin/client/customize-store/index.tsx
index a2af5df160..4c9ab3ff26 100644
--- a/plugins/woocommerce/client/admin/client/customize-store/index.tsx
+++ b/plugins/woocommerce/client/admin/client/customize-store/index.tsx
@@ -24,7 +24,6 @@ import { chevronRight, chevronLeft } from '@wordpress/icons';
*/
import { useFullScreen } from '~/utils';
import { isWooExpress } from '~/utils/is-woo-express';
-import { isFeatureEnabled } from '~/utils/features';
import { SiteHub } from './site-hub';
import { OPTIONS_STORE_NAME } from '@woocommerce/data';
import { useDispatch, useSelect } from '@wordpress/data';
@@ -61,12 +60,9 @@ const CustomizeStoreController = () => {
if ( isWooExpress() ) {
return getAdminLink( 'themes.php' );
}
- if ( isFeatureEnabled( 'marketplace' ) ) {
- return getAdminLink(
- 'admin.php?page=wc-admin&tab=themes&path=%2Fextensions'
- );
- }
- return 'https://woocommerce.com/product-category/themes/';
+ return getAdminLink(
+ 'admin.php?page=wc-admin&tab=themes&path=%2Fextensions'
+ );
}, [] );
useEffect( () => {
diff --git a/plugins/woocommerce/client/admin/client/layout/controller.js b/plugins/woocommerce/client/admin/client/layout/controller.js
index 25f70246d7..5018838d0f 100644
--- a/plugins/woocommerce/client/admin/client/layout/controller.js
+++ b/plugins/woocommerce/client/admin/client/layout/controller.js
@@ -175,24 +175,22 @@ export const getPages = ( reports = [] ) => {
} );
}
- if ( isFeatureEnabled( 'marketplace' ) ) {
- pages.push( {
- container: Marketplace,
- layout: {
- header: false,
- },
- path: '/extensions',
- breadcrumbs: [
- [ '/extensions', __( 'Extensions', 'woocommerce' ) ],
- __( 'Extensions', 'woocommerce' ),
- ],
- wpOpenMenu: 'toplevel_page_woocommerce',
- capability: 'manage_woocommerce',
- navArgs: {
- id: 'woocommerce-marketplace',
- },
- } );
- }
+ pages.push( {
+ container: Marketplace,
+ layout: {
+ header: false,
+ },
+ path: '/extensions',
+ breadcrumbs: [
+ [ '/extensions', __( 'Extensions', 'woocommerce' ) ],
+ __( 'Extensions', 'woocommerce' ),
+ ],
+ wpOpenMenu: 'toplevel_page_woocommerce',
+ capability: 'manage_woocommerce',
+ navArgs: {
+ id: 'woocommerce-marketplace',
+ },
+ } );
if ( isFeatureEnabled( 'product_block_editor' ) ) {
const productPage = {
diff --git a/plugins/woocommerce/client/admin/client/payments/payment-recommendations.tsx b/plugins/woocommerce/client/admin/client/payments/payment-recommendations.tsx
index 0d73f044b5..18146ebd1a 100644
--- a/plugins/woocommerce/client/admin/client/payments/payment-recommendations.tsx
+++ b/plugins/woocommerce/client/admin/client/payments/payment-recommendations.tsx
@@ -26,7 +26,6 @@ import { createNoticesFromResponse } from '~/lib/notices';
import { getPluginSlug } from '~/utils';
import { isWcPaySupported } from './utils';
import { TrackedLink } from '~/components/tracked-link/tracked-link';
-import { isFeatureEnabled } from '~/utils/features';
const WcPayPromotionGateway = document.querySelector(
'[data-gateway_id="pre_install_woocommerce_payments_promotion"]'
@@ -267,18 +266,10 @@ const PaymentRecommendations = () => {
'woocommerce'
) }
eventName="settings_payment_recommendations_visit_marketplace_click"
- targetUrl={
- isFeatureEnabled( 'marketplace' )
- ? getAdminLink(
- 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=payment-gateways'
- )
- : 'https://woocommerce.com/product-category/woocommerce-extensions/payment-gateways/'
- }
- linkType={
- isFeatureEnabled( 'marketplace' )
- ? 'wc-admin'
- : 'external'
- }
+ targetUrl={ getAdminLink(
+ 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=payment-gateways'
+ ) }
+ linkType="wc-admin"
/>
</CardFooter>
</Card>
diff --git a/plugins/woocommerce/client/admin/client/shipping/shipping-recommendations.tsx b/plugins/woocommerce/client/admin/client/shipping/shipping-recommendations.tsx
index e9e4f29c36..361b75a06a 100644
--- a/plugins/woocommerce/client/admin/client/shipping/shipping-recommendations.tsx
+++ b/plugins/woocommerce/client/admin/client/shipping/shipping-recommendations.tsx
@@ -23,7 +23,6 @@ import {
import WoocommerceShippingItem from './woocommerce-shipping-item';
import './shipping-recommendations.scss';
import { TrackedLink } from '~/components/tracked-link/tracked-link';
-import { isFeatureEnabled } from '~/utils/features';
const useInstallPlugin = () => {
const [ pluginsBeingSetup, setPluginsBeingSetup ] = useState<
@@ -92,16 +91,10 @@ export const ShippingRecommendationsList = ( {
'Visit {{Link}}the WooCommerce Marketplace{{/Link}} to find more shipping, delivery, and fulfillment solutions.',
'woocommerce'
) }
- targetUrl={
- isFeatureEnabled( 'marketplace' )
- ? getAdminLink(
- 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=shipping-delivery-and-fulfillment'
- )
- : 'https://woocommerce.com/product-category/woocommerce-extensions/shipping-delivery-and-fulfillment/'
- }
- linkType={
- isFeatureEnabled( 'marketplace' ) ? 'wc-admin' : 'external'
- }
+ targetUrl={ getAdminLink(
+ 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=shipping-delivery-and-fulfillment'
+ ) }
+ linkType="wc-admin"
eventName="settings_shipping_recommendation_visit_marketplace_click"
/>
</CardFooter>
diff --git a/plugins/woocommerce/client/admin/client/task-lists/fills/Marketing/index.tsx b/plugins/woocommerce/client/admin/client/task-lists/fills/Marketing/index.tsx
index 785d0ae480..7b029e4f1b 100644
--- a/plugins/woocommerce/client/admin/client/task-lists/fills/Marketing/index.tsx
+++ b/plugins/woocommerce/client/admin/client/task-lists/fills/Marketing/index.tsx
@@ -27,7 +27,6 @@ import { PluginList, PluginListProps } from './PluginList';
import { PluginProps } from './Plugin';
import { getPluginSlug } from '../../../utils';
import { TaskPromo } from './TaskPromo';
-import { isFeatureEnabled } from '~/utils/features';
// We display the list of plugins ordered by this list.
const ALLOWED_PLUGIN_LISTS = [ 'task-list/grow', 'task-list/reach' ];
@@ -258,13 +257,9 @@ const Marketing = ( { onComplete }: MarketingProps ) => {
' the WooCommerce marketplace.',
'woocommerce'
) }
- buttonHref={
- isFeatureEnabled( 'marketplace' )
- ? getAdminLink(
- 'admin.php?page=wc-admin&tab=extensions&path=%2Fextensions&category=marketing-extensions'
- )
- : 'https://woocommerce.com/product-category/woocommerce-extensions/marketing-extensions/'
- }
+ buttonHref={ getAdminLink(
+ 'admin.php?page=wc-admin&tab=extensions&path=%2Fextensions&category=marketing-extensions'
+ ) }
buttonText={ __( 'Start growing', 'woocommerce' ) }
onButtonClick={ trackPromoButtonClick }
/>
diff --git a/plugins/woocommerce/client/admin/client/task-lists/fills/PaymentGatewaySuggestions/index.js b/plugins/woocommerce/client/admin/client/task-lists/fills/PaymentGatewaySuggestions/index.js
index f67a26c70a..2013c193bf 100644
--- a/plugins/woocommerce/client/admin/client/task-lists/fills/PaymentGatewaySuggestions/index.js
+++ b/plugins/woocommerce/client/admin/client/task-lists/fills/PaymentGatewaySuggestions/index.js
@@ -35,7 +35,6 @@ import './plugins/Bacs';
import './payment-gateway-suggestions.scss';
import { getPluginSlug } from '~/utils';
import { TrackedLink } from '~/components/tracked-link/tracked-link';
-import { isFeatureEnabled } from '~/utils/features';
export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
const { updatePaymentGateway } = useDispatch( PAYMENT_GATEWAYS_STORE_NAME );
@@ -276,18 +275,10 @@ export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
'woocommerce'
) }
onClickCallback={ trackSeeMore }
- targetUrl={
- isFeatureEnabled( 'marketplace' )
- ? getAdminLink(
- 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=payment-gateways'
- )
- : 'https://woocommerce.com/product-category/woocommerce-extensions/payment-gateways/'
- }
- linkType={
- isFeatureEnabled( 'marketplace' )
- ? 'wc-admin'
- : 'external'
- }
+ targetUrl={ getAdminLink(
+ 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=payment-gateways'
+ ) }
+ linkType="wc-admin"
/>
}
></List>
diff --git a/plugins/woocommerce/client/admin/client/task-lists/fills/experimental-shipping-recommendation/shipping-recommendation.tsx b/plugins/woocommerce/client/admin/client/task-lists/fills/experimental-shipping-recommendation/shipping-recommendation.tsx
index 82ef5af93f..f4d4099e19 100644
--- a/plugins/woocommerce/client/admin/client/task-lists/fills/experimental-shipping-recommendation/shipping-recommendation.tsx
+++ b/plugins/woocommerce/client/admin/client/task-lists/fills/experimental-shipping-recommendation/shipping-recommendation.tsx
@@ -18,7 +18,6 @@ import { WCSBanner } from './components/wcs-banner';
import { TaskProps, ShippingRecommendationProps } from './types';
import { redirectToWCSSettings } from './utils';
import { TrackedLink } from '~/components/tracked-link/tracked-link';
-import { isFeatureEnabled } from '~/utils/features';
/**
* Plugins required to automate shipping.
@@ -157,16 +156,10 @@ export const ShippingRecommendation = ( {
'woocommerce'
) }
eventName="tasklist_shipping_recommendation_visit_marketplace_click"
- targetUrl={
- isFeatureEnabled( 'marketplace' )
- ? getAdminLink(
- 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=shipping-delivery-and-fulfillment'
- )
- : 'https://woocommerce.com/product-category/woocommerce-extensions/shipping-delivery-and-fulfillment/'
- }
- linkType={
- isFeatureEnabled( 'marketplace' ) ? 'wc-admin' : 'external'
- }
+ targetUrl={ getAdminLink(
+ 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=shipping-delivery-and-fulfillment'
+ ) }
+ linkType="wc-admin"
/>
</div>
);
diff --git a/plugins/woocommerce/client/admin/client/task-lists/fills/products/index.tsx b/plugins/woocommerce/client/admin/client/task-lists/fills/products/index.tsx
index 4cb1f7ffeb..569539dc48 100644
--- a/plugins/woocommerce/client/admin/client/task-lists/fills/products/index.tsx
+++ b/plugins/woocommerce/client/admin/client/task-lists/fills/products/index.tsx
@@ -33,7 +33,6 @@ import {
SponsoredProductPlacementType,
} from './constants';
import { TrackedLink } from '~/components/tracked-link/tracked-link';
-import { isFeatureEnabled } from '~/utils/features';
const getOnboardingProductType = (): string[] => {
const onboardingData = getAdminSetting( 'onboarding' );
@@ -200,18 +199,10 @@ export const Products = () => {
'woocommerce'
) }
eventName="tasklist_add_product_visit_marketplace_click"
- targetUrl={
- isFeatureEnabled( 'marketplace' )
- ? getAdminLink(
- 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=merchandising'
- )
- : 'https://woocommerce.com/product-category/woocommerce-extensions/merchandising/'
- }
- linkType={
- isFeatureEnabled( 'marketplace' )
- ? 'wc-admin'
- : 'external'
- }
+ targetUrl={ getAdminLink(
+ 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=merchandising'
+ ) }
+ linkType="wc-admin"
/>
</div>
{ isLoadingSampleProducts ? (
diff --git a/plugins/woocommerce/client/admin/client/task-lists/fills/shipping/index.js b/plugins/woocommerce/client/admin/client/task-lists/fills/shipping/index.js
index eef0d5d4d8..65f357757b 100644
--- a/plugins/woocommerce/client/admin/client/task-lists/fills/shipping/index.js
+++ b/plugins/woocommerce/client/admin/client/task-lists/fills/shipping/index.js
@@ -39,7 +39,6 @@ import {
} from './shipping-providers/partners';
import { TermsOfService } from '~/task-lists/components/terms-of-service';
import { TrackedLink } from '~/components/tracked-link/tracked-link';
-import { isFeatureEnabled } from '~/utils/features';
export class Shipping extends Component {
constructor( props ) {
@@ -666,18 +665,10 @@ export class Shipping extends Component {
'woocommerce'
) }
eventName="tasklist_shipping_visit_marketplace_click"
- targetUrl={
- isFeatureEnabled( 'marketplace' )
- ? getAdminLink(
- 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=shipping-delivery-and-fulfillment'
- )
- : 'https://woocommerce.com/product-category/woocommerce-extensions/shipping-delivery-and-fulfillment/'
- }
- linkType={
- isFeatureEnabled( 'marketplace' )
- ? 'wc-admin'
- : 'external'
- }
+ targetUrl={ getAdminLink(
+ 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=shipping-delivery-and-fulfillment'
+ ) }
+ linkType="wc-admin"
/>
</div>
);
diff --git a/plugins/woocommerce/client/admin/client/task-lists/fills/tax/components/partners.tsx b/plugins/woocommerce/client/admin/client/task-lists/fills/tax/components/partners.tsx
index fc1f84b05a..211c8ddd63 100644
--- a/plugins/woocommerce/client/admin/client/task-lists/fills/tax/components/partners.tsx
+++ b/plugins/woocommerce/client/admin/client/task-lists/fills/tax/components/partners.tsx
@@ -13,7 +13,6 @@ import { getAdminLink } from '@woocommerce/settings';
import { TaxChildProps } from '../utils';
import { TrackedLink } from '~/components/tracked-link/tracked-link';
import './partners.scss';
-import { isFeatureEnabled } from '~/utils/features';
export const Partners = ( {
children,
@@ -81,16 +80,10 @@ export const Partners = ( {
'woocommerce'
) }
eventName="tasklist_tax_visit_marketplace_click"
- targetUrl={
- isFeatureEnabled( 'marketplace' )
- ? getAdminLink(
- 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=operations'
- )
- : 'https://woocommerce.com/product-category/woocommerce-extensions/operations/'
- }
- linkType={
- isFeatureEnabled( 'marketplace' ) ? 'wc-admin' : 'external'
- }
+ targetUrl={ getAdminLink(
+ 'admin.php?page=wc-admin&tab=extensions&path=/extensions&category=operations'
+ ) }
+ linkType="wc-admin"
/>
</>
);
diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-menus.php b/plugins/woocommerce/includes/admin/class-wc-admin-menus.php
index 37a4da4a4f..128cd879ef 100644
--- a/plugins/woocommerce/includes/admin/class-wc-admin-menus.php
+++ b/plugins/woocommerce/includes/admin/class-wc-admin-menus.php
@@ -56,14 +56,10 @@ class WC_Admin_Menus {
* @param bool $show_addons_page If the addons page should be included.
*/
if ( apply_filters( 'woocommerce_show_addons_page', true ) ) {
- if ( FeaturesUtil::feature_is_enabled( 'marketplace' ) ) {
- $container = wc_get_container();
- $container->get( Marketplace::class );
+ $container = wc_get_container();
+ $container->get( Marketplace::class );
- add_action( 'admin_menu', array( $this, 'addons_my_subscriptions' ), 70 );
- } else {
- add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 );
- }
+ add_action( 'admin_menu', array( $this, 'addons_my_subscriptions' ), 70 );
}
add_filter( 'menu_order', array( $this, 'menu_order' ) );
@@ -207,8 +203,12 @@ class WC_Admin_Menus {
/**
* Addons menu item.
+ *
+ * @deprecated 10.5.0 The marketplace feature is now always enabled. Use the Extensions menu instead.
*/
public function addons_menu() {
+ wc_deprecated_function( __METHOD__, '10.5.0' );
+
$count_html = WC_Helper_Updater::get_updates_count_html();
/* translators: %s: extensions count */
$menu_title = sprintf( __( 'Extensions %s', 'woocommerce' ), $count_html );
diff --git a/plugins/woocommerce/includes/admin/helper/class-wc-helper.php b/plugins/woocommerce/includes/admin/helper/class-wc-helper.php
index 9580154323..41053158f7 100644
--- a/plugins/woocommerce/includes/admin/helper/class-wc-helper.php
+++ b/plugins/woocommerce/includes/admin/helper/class-wc-helper.php
@@ -7,7 +7,6 @@
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Admin\PluginsHelper;
-use Automattic\WooCommerce\Utilities\FeaturesUtil;
use Automattic\WooCommerce\Admin\Notes\Note;
if ( ! defined( 'ABSPATH' ) ) {
@@ -814,7 +813,6 @@ class WC_Helper {
if (
( 'woocommerce_page_wc-addons' === $current_screen->id ||
'woocommerce_page_wc-admin' === $current_screen->id ) &&
- FeaturesUtil::feature_is_enabled( 'marketplace' ) &&
(
false === empty( $redirect_admin_url ) ||
false === empty( $install_product_key )
diff --git a/plugins/woocommerce/includes/admin/helper/views/html-section-nav.php b/plugins/woocommerce/includes/admin/helper/views/html-section-nav.php
index bdbb4671b5..a1e1a9cb35 100644
--- a/plugins/woocommerce/includes/admin/helper/views/html-section-nav.php
+++ b/plugins/woocommerce/includes/admin/helper/views/html-section-nav.php
@@ -7,12 +7,7 @@
* @deprecated 5.7.0
*/
-use Automattic\WooCommerce\Utilities\FeaturesUtil;
-
-$addons_url = admin_url( 'admin.php?page=wc-addons' );
-if ( FeaturesUtil::feature_is_enabled( 'marketplace' ) ) {
- $addons_url = admin_url( 'admin.php?page=wc-admin&path=/extensions&tab=extensions' );
-}
+$addons_url = admin_url( 'admin.php?page=wc-admin&path=/extensions&tab=extensions' );
defined( 'ABSPATH' ) || exit(); ?>
diff --git a/plugins/woocommerce/includes/class-wc-install.php b/plugins/woocommerce/includes/class-wc-install.php
index c9b41c552f..79908674dd 100644
--- a/plugins/woocommerce/includes/class-wc-install.php
+++ b/plugins/woocommerce/includes/class-wc-install.php
@@ -317,6 +317,7 @@ class WC_Install {
'wc_update_1050_migrate_brand_permalink_setting',
'wc_update_1050_enable_autoload_options',
'wc_update_1050_add_idx_user_email',
+ 'wc_update_1050_remove_deprecated_marketplace_option',
),
);
diff --git a/plugins/woocommerce/includes/wc-update-functions.php b/plugins/woocommerce/includes/wc-update-functions.php
index 7226d9b3e0..0878f2e08a 100644
--- a/plugins/woocommerce/includes/wc-update-functions.php
+++ b/plugins/woocommerce/includes/wc-update-functions.php
@@ -3190,7 +3190,6 @@ function wc_update_1050_enable_autoload_options() {
$feature_options = array(
'fulfillments' => 'woocommerce_feature_fulfillments_enabled',
- 'marketplace' => 'woocommerce_feature_marketplace_enabled',
'push_notifications' => 'woocommerce_feature_push_notifications_enabled',
'agentic_checkout' => 'woocommerce_feature_agentic_checkout_enabled',
'cart_checkout_blocks' => 'woocommerce_feature_cart_checkout_blocks_enabled',
@@ -3216,3 +3215,18 @@ function wc_update_1050_enable_autoload_options() {
)
);
}
+
+/**
+ * Remove deprecated marketplace feature option from the database.
+ *
+ * The marketplace feature flag was deprecated in 10.5.0 and is now always enabled.
+ * The option is no longer needed as FeaturesUtil::feature_is_enabled('marketplace')
+ * returns the deprecated_value directly without reading from the database.
+ *
+ * @since 10.5.0
+ *
+ * @return void
+ */
+function wc_update_1050_remove_deprecated_marketplace_option(): void {
+ delete_option( 'woocommerce_feature_marketplace_enabled' );
+}
diff --git a/plugins/woocommerce/src/Internal/Admin/Marketplace.php b/plugins/woocommerce/src/Internal/Admin/Marketplace.php
index 6bc63db2df..a1f3c04eec 100644
--- a/plugins/woocommerce/src/Internal/Admin/Marketplace.php
+++ b/plugins/woocommerce/src/Internal/Admin/Marketplace.php
@@ -5,8 +5,6 @@
namespace Automattic\WooCommerce\Internal\Admin;
-use Automattic\WooCommerce\Utilities\FeaturesUtil;
-use Automattic\WooCommerce\Internal\Features\FeaturesController;
use WC_Helper_Options;
use WC_Helper_Updater;
@@ -29,12 +27,6 @@ class Marketplace {
* Hook into WordPress on init.
*/
public function on_init() {
- if ( false === FeaturesUtil::feature_is_enabled( 'marketplace' ) ) {
- /** Feature controller instance @var FeaturesController $feature_controller */
- $feature_controller = wc_get_container()->get( FeaturesController::class );
- $feature_controller->change_feature_enable( 'marketplace', true );
- }
-
add_action( 'admin_menu', array( $this, 'register_pages' ), 70 );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
diff --git a/plugins/woocommerce/src/Internal/Features/FeaturesController.php b/plugins/woocommerce/src/Internal/Features/FeaturesController.php
index 98083025da..0fbf795bd1 100644
--- a/plugins/woocommerce/src/Internal/Features/FeaturesController.php
+++ b/plugins/woocommerce/src/Internal/Features/FeaturesController.php
@@ -203,6 +203,11 @@ class FeaturesController {
* Higher number = higher in the list. Defaults to 10.
* @type array $setting The properties used by the Settings API to render the setting control on
* the Features screen. See the Settings API for the schema of these props.
+ * @type string $deprecated_since The WooCommerce version since which this feature is deprecated.
+ * When set, feature_is_enabled() will force feature value to the deprecated_value
+ * instead of reading from the database.
+ * @type bool $deprecated_value The value to return for deprecated features when feature_is_enabled()
+ * is called. Defaults to false.
* }
*
* @return void
@@ -334,6 +339,8 @@ class FeaturesController {
'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.
@@ -740,7 +747,14 @@ class FeaturesController {
if ( $include_enabled_info ) {
foreach ( array_keys( $features ) as $feature_id ) {
- $is_enabled = $this->feature_is_enabled( $feature_id );
+ $is_enabled = false;
+ // For deprecated features, use the deprecated_value directly without triggering the deprecation notice.
+ // The deprecation notice should only fire for external code checking feature status, not for internal listing.
+ if ( ! empty( $features[ $feature_id ]['deprecated_since'] ) ) {
+ $is_enabled = (bool) ( $features[ $feature_id ]['deprecated_value'] ?? false );
+ } else {
+ $is_enabled = $this->feature_is_enabled( $feature_id );
+ }
$features[ $feature_id ]['is_enabled'] = $is_enabled;
}
}
@@ -764,12 +778,12 @@ class FeaturesController {
* @throws \InvalidArgumentException If the feature doesn't exist.
*/
public function get_default_plugin_compatibility( string $feature_id ): string {
- $feature_definition = $this->get_feature_definitions()[ $feature_id ] ?? null;
- if ( is_null( $feature_definition ) ) {
+ $feature = $this->get_feature_definition( $feature_id );
+ if ( null === $feature ) {
throw new \InvalidArgumentException( esc_html( "The WooCommerce feature '$feature_id' doesn't exist" ) );
}
- $default_plugin_compatibility = $feature_definition['default_plugin_compatibility'] ?? FeaturePluginCompatibility::COMPATIBLE;
+ $default_plugin_compatibility = $feature['default_plugin_compatibility'] ?? FeaturePluginCompatibility::COMPATIBLE;
// Filter below is only fired for backwards compatibility with (now removed) get_plugins_are_incompatible_by_default().
/**
@@ -786,6 +800,42 @@ class FeaturesController {
return $incompatible_by_default ? FeaturePluginCompatibility::INCOMPATIBLE : FeaturePluginCompatibility::COMPATIBLE;
}
+ /**
+ * Get the definition array for a specific feature.
+ *
+ * @param string $feature_id Unique feature id.
+ * @return array|null The feature definition array, or null if the feature doesn't exist.
+ *
+ * @since 10.5.0
+ */
+ private function get_feature_definition( string $feature_id ): ?array {
+ return $this->get_feature_definitions()[ $feature_id ] ?? null;
+ }
+
+ /**
+ * Log usage of a deprecated feature.
+ *
+ * This method ensures logging only happens once per request to avoid spam.
+ *
+ * @param string $feature_id The feature id being checked.
+ * @param string $deprecated_since The version since which the feature is deprecated.
+ *
+ * @since 10.5.0
+ */
+ private function log_deprecated_feature_usage( string $feature_id, string $deprecated_since ): void {
+ static $logged = array();
+
+ if ( isset( $logged[ $feature_id ] ) ) {
+ return;
+ }
+ $logged[ $feature_id ] = true;
+
+ wc_deprecated_function(
+ "FeaturesUtil::feature_is_enabled('{$feature_id}')",
+ $deprecated_since
+ );
+ }
+
/**
* Check if a given feature is currently enabled.
*
@@ -793,10 +843,18 @@ class FeaturesController {
* @return bool True if the feature is enabled, false if not or if the feature doesn't exist.
*/
public function feature_is_enabled( string $feature_id ): bool {
- if ( ! $this->feature_exists( $feature_id ) ) {
+ $feature = $this->get_feature_definition( $feature_id );
+
+ if ( null === $feature ) {
return false;
}
+ // Handle deprecated features - return the backwards-compatible value.
+ if ( ! empty( $feature['deprecated_since'] ) ) {
+ $this->log_deprecated_feature_usage( $feature_id, $feature['deprecated_since'] );
+ return (bool) ( $feature['deprecated_value'] ?? false );
+ }
+
if ( $this->is_preview_email_improvements_enabled( $feature_id ) ) {
return true;
}