From 820cb1c30856f90af34f44d940b890a48bd67d97 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 06:43:53 -0700 Subject: [PATCH] Cherry pick 51664 into release/9.4 (#51849) * Add core feature for site visibility badge (#51664) * Add site_visibility_badge feature * Update feature check on badge Previously the WooCommerce Admin LYS feature flag was used, however this is slated to be removed in an upcoming release. This is updated to use the core level feature flag for the badge. * Add changelog * Fix lint issues * Revert "Fix lint issues" This reverts commit cf05d2b74fe54d752c6d76cc00c9315ec9ff8b81. * Lint fixes * lint * Prep for cherry pick 51664 --------- Co-authored-by: Adrian Duffell <9312929+adrianduffell@users.noreply.github.com> Co-authored-by: WooCommerce Bot --- plugins/woocommerce/readme.txt | 1 + .../ComingSoon/ComingSoonAdminBarBadge.php | 7 ++--- .../Internal/Features/FeaturesController.php | 26 ++++++++++++++----- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/plugins/woocommerce/readme.txt b/plugins/woocommerce/readme.txt index 19773211970..76ffce19e77 100644 --- a/plugins/woocommerce/readme.txt +++ b/plugins/woocommerce/readme.txt @@ -220,6 +220,7 @@ WooCommerce comes with some sample data you can use to see how products look; im * Fix - Use `get_filtered_ids` consistently in `reports/taxes` and `reports/taxes/stats` datastores [#51219](https://github.com/woocommerce/woocommerce/pull/51219) * Fix - wc_get_cart_url should only return current URL if on the cart page. This excludes the usage of WOOCOMMERCE_CART. [#51384](https://github.com/woocommerce/woocommerce/pull/51384) * Fix - Wrap parse_str under a check to resolve deprecation notice [#51474](https://github.com/woocommerce/woocommerce/pull/51474) +* Add - Add core feature for site visibility badge [#51664](https://github.com/woocommerce/woocommerce/pull/51664) * Add - Added a Load More button to product lists on the Extensions page, to request additional search results from WooCommerce.com. [#51413](https://github.com/woocommerce/woocommerce/pull/51413) * Add - Add endpoint title to the document title. [#50900](https://github.com/woocommerce/woocommerce/pull/50900) * Add - Add global_unique_id parameter to products REST API [#51264](https://github.com/woocommerce/woocommerce/pull/51264) diff --git a/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonAdminBarBadge.php b/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonAdminBarBadge.php index 082944cd3b6..140b49a3a6d 100644 --- a/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonAdminBarBadge.php +++ b/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonAdminBarBadge.php @@ -4,7 +4,8 @@ declare( strict_types = 1 ); namespace Automattic\WooCommerce\Internal\ComingSoon; -use Automattic\WooCommerce\Admin\Features\Features; +use Automattic\WooCommerce\Utilities\FeaturesUtil; + /** * Adds hooks to add a badge to the WordPress admin bar showing site visibility. @@ -30,7 +31,7 @@ class ComingSoonAdminBarBadge { */ public function site_visibility_badge( $wp_admin_bar ) { // Early exit if LYS feature is disabled. - if ( ! Features::is_enabled( 'launch-your-store' ) ) { + if ( ! FeaturesUtil::feature_is_enabled( 'site_visibility_badge' ) ) { return; } @@ -68,7 +69,7 @@ class ComingSoonAdminBarBadge { */ public function output_css() { // Early exit if LYS feature is disabled. - if ( ! Features::is_enabled( 'launch-your-store' ) ) { + if ( ! FeaturesUtil::feature_is_enabled( 'site_visibility_badge' ) ) { return; } diff --git a/plugins/woocommerce/src/Internal/Features/FeaturesController.php b/plugins/woocommerce/src/Internal/Features/FeaturesController.php index e777fc63fb8..518c1e7027f 100644 --- a/plugins/woocommerce/src/Internal/Features/FeaturesController.php +++ b/plugins/woocommerce/src/Internal/Features/FeaturesController.php @@ -164,7 +164,7 @@ class FeaturesController { private function get_feature_definitions() { if ( empty( $this->features ) ) { $legacy_features = array( - 'analytics' => array( + 'analytics' => array( 'name' => __( 'Analytics', 'woocommerce' ), 'description' => __( 'Enable WooCommerce Analytics', 'woocommerce' ), 'option_key' => Analytics::TOGGLE_OPTION_NAME, @@ -173,7 +173,7 @@ class FeaturesController { 'disable_ui' => false, 'is_legacy' => true, ), - 'product_block_editor' => array( + 'product_block_editor' => array( 'name' => __( 'New product editor', 'woocommerce' ), 'description' => __( 'Try the new product editor (Beta)', 'woocommerce' ), 'is_experimental' => true, @@ -194,13 +194,13 @@ class FeaturesController { return $string; }, ), - 'cart_checkout_blocks' => array( + 'cart_checkout_blocks' => array( 'name' => __( 'Cart & Checkout Blocks', 'woocommerce' ), 'description' => __( 'Optimize for faster checkout', 'woocommerce' ), 'is_experimental' => false, 'disable_ui' => true, ), - 'marketplace' => array( + 'marketplace' => array( 'name' => __( 'Marketplace', 'woocommerce' ), 'description' => __( 'New, faster way to find extensions and themes for your WooCommerce store', @@ -213,7 +213,7 @@ class FeaturesController { ), // 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( + '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', @@ -224,7 +224,19 @@ class FeaturesController { 'is_legacy' => true, 'is_experimental' => false, ), - 'hpos_fts_indexes' => array( + '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, + 'is_legacy' => true, + '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.', @@ -235,7 +247,7 @@ class FeaturesController { 'is_legacy' => true, 'option_key' => CustomOrdersTableController::HPOS_FTS_INDEX_OPTION, ), - 'remote_logging' => array( + 'remote_logging' => array( 'name' => __( 'Remote Logging', 'woocommerce' ), 'description' => __( 'Enable this feature to log errors and related data to Automattic servers for debugging purposes and to improve WooCommerce',