Commit 32c515c8f5b for woocommerce

commit 32c515c8f5b2b49589a0264b3d1f69eb135dc335
Author: Ricardo Sawir <37329575+sawirricardo@users.noreply.github.com>
Date:   Thu Jul 2 12:44:14 2026 +0700

    Move site visibility badge setting to Site Visibility settings tab (#65708)

    * Move site visibility badge setting to Site Visibility settings tab

    The site visibility badge toggle was located in the Advanced > Features
    settings tab, separated from the other site visibility settings. This
    moves it to the Site Visibility settings tab where it logically belongs.

    Changes:
    - Hide the feature toggle from Advanced > Features (disable_ui: true)
    - Add woocommerce_site_visibility_badge option to site visibility save handler
    - Add badge toggle to Site Visibility React settings UI
    - Update ComingSoonAdminBarBadge to check new option with fallback to
      legacy feature flag for backward compatibility

    Fixes #65614

    * Align site visibility badge toggle with its label

    Address review feedback on #65708: the badge toggle sat in its own
    section without the `-content` wrapper, so the switch was vertically
    centered against the label + description block instead of aligned with
    the label, and adding the section stripped the spacing between the
    "Coming soon" and "Live" sections (the spacing relied on `:last-child`).

    - Move the toggle alignment rules (toggle margin, `align-items: baseline`,
      description paragraph spacing) out of `-content` to the section level so
      they apply to top-level toggles too.
    - Replace the fragile `:last-child` section spacing with an adjacent-sibling
      rule so consecutive sections keep their spacing regardless of which is last.

    * Fix redundant nesting selector in site visibility styles

    Drop the redundant '&' from the adjacent-sibling selector so it passes stylelint's 'scss/selector-no-redundant-nesting-selector' rule. A leading '+' combinator compiles to the same output.

    * Reuse feature option for site visibility badge toggle

    Store the badge setting in the existing woocommerce_feature_site_visibility_badge_enabled option instead of a separate option, removing the second source of truth and the migration fallback. The Site Visibility save handler and preload now read/write that option, deriving the preloaded default from FeaturesUtil so a disabled badge is never re-enabled.

    Also simplify the badge section markup to reuse the existing section-content toggle styles and use the ToggleControl enabled argument directly.

    * Read badge option directly with get_option instead of FeaturesUtil

    ---------

    Co-authored-by: Luigi Teschio <gigitux@gmail.com>

diff --git a/plugins/woocommerce/changelog/65614-site-visibility-badge-toggle b/plugins/woocommerce/changelog/65614-site-visibility-badge-toggle
new file mode 100644
index 00000000000..dc1f911929a
--- /dev/null
+++ b/plugins/woocommerce/changelog/65614-site-visibility-badge-toggle
@@ -0,0 +1,4 @@
+Significance: patch
+Type: tweak
+
+Move the "Display site visibility badge in admin bar" toggle into the Site Visibility settings tab and align the toggle with its label.
diff --git a/plugins/woocommerce/client/admin/client/launch-your-store/settings/slotfill.js b/plugins/woocommerce/client/admin/client/launch-your-store/settings/slotfill.js
index 468245519c6..f44c6f2444d 100644
--- a/plugins/woocommerce/client/admin/client/launch-your-store/settings/slotfill.js
+++ b/plugins/woocommerce/client/admin/client/launch-your-store/settings/slotfill.js
@@ -47,6 +47,9 @@ const SiteVisibility = () => {
 	const [ privateLink, setPrivateLink ] = useState(
 		setting?.woocommerce_private_link || 'no'
 	);
+	const [ siteVisibilityBadge, setSiteVisibilityBadge ] = useState(
+		setting?.woocommerce_feature_site_visibility_badge_enabled || 'yes'
+	);
 	const formRef = useRef( null );
 	const saveButtonRef = useRef( null );

@@ -74,9 +77,17 @@ const SiteVisibility = () => {
 			comingSoon: setting.woocommerce_coming_soon,
 			storePagesOnly: setting.woocommerce_store_pages_only,
 			privateLink: setting.woocommerce_private_link || 'no',
+			siteVisibilityBadge:
+				setting.woocommerce_feature_site_visibility_badge_enabled ||
+				'yes',
 		};

-		const currentValues = { comingSoon, storePagesOnly, privateLink };
+		const currentValues = {
+			comingSoon,
+			storePagesOnly,
+			privateLink,
+			siteVisibilityBadge,
+		};
 		const saveButton = document.getElementsByClassName(
 			'woocommerce-save-button'
 		)[ 0 ];
@@ -84,9 +95,11 @@ const SiteVisibility = () => {
 			saveButton.disabled =
 				initValues.comingSoon === currentValues.comingSoon &&
 				initValues.storePagesOnly === currentValues.storePagesOnly &&
-				initValues.privateLink === currentValues.privateLink;
+				initValues.privateLink === currentValues.privateLink &&
+				initValues.siteVisibilityBadge ===
+					currentValues.siteVisibilityBadge;
 		}
-	}, [ comingSoon, storePagesOnly, privateLink ] );
+	}, [ comingSoon, storePagesOnly, privateLink, siteVisibilityBadge ] );

 	const copyLink = __( 'Copy link', 'woocommerce' );
 	const copied = __( 'Copied!', 'woocommerce' );
@@ -136,6 +149,11 @@ const SiteVisibility = () => {
 				value={ privateLink }
 				name="woocommerce_private_link"
 			/>
+			<input
+				type="hidden"
+				value={ siteVisibilityBadge }
+				name="woocommerce_feature_site_visibility_badge_enabled"
+			/>
 			<h2>{ __( 'Site visibility', 'woocommerce' ) }</h2>
 			<p className="site-visibility-settings-slotfill-description">
 				{ createInterpolateElement(
@@ -209,7 +227,7 @@ const SiteVisibility = () => {
 								) }
 								<p>
 									{ __(
-										'Display a “coming soon” message on your store pages — the rest of your site will remain visible.',
+										'Display a "coming soon" message on your store pages — the rest of your site will remain visible.',
 										'woocommerce'
 									) }
 								</p>
@@ -298,6 +316,34 @@ const SiteVisibility = () => {
 					) }
 				</p>
 			</div>
+			<div className="site-visibility-settings-slotfill-section">
+				<div className="site-visibility-settings-slotfill-section-content site-visibility-settings-slotfill-section-visibility-badge">
+					<ToggleControl
+						__nextHasNoMarginBottom
+						label={
+							<>
+								{ __(
+									'Display site visibility badge in admin bar',
+									'woocommerce'
+								) }
+								<p>
+									{ __(
+										'Show the site visibility status badge in the WordPress admin bar.',
+										'woocommerce'
+									) }
+								</p>
+							</>
+						}
+						checked={ siteVisibilityBadge === 'yes' }
+						onChange={ ( enabled ) => {
+							setSiteVisibilityBadge( enabled ? 'yes' : 'no' );
+							recordEvent( 'site_visibility_badge_toggle', {
+								enabled,
+							} );
+						} }
+					/>
+				</div>
+			</div>
 			{ formRef.current && saveButtonRef.current ? (
 				<ConfirmationModal
 					saveButtonRef={ saveButtonRef }
diff --git a/plugins/woocommerce/client/admin/client/launch-your-store/settings/style.scss b/plugins/woocommerce/client/admin/client/launch-your-store/settings/style.scss
index 17651289564..f63b2f252f1 100644
--- a/plugins/woocommerce/client/admin/client/launch-your-store/settings/style.scss
+++ b/plugins/woocommerce/client/admin/client/launch-your-store/settings/style.scss
@@ -99,7 +99,10 @@
 	.site-visibility-settings-slotfill-section {
 		max-width: 650px;

-		&:last-child {
+		// Separate consecutive sections rather than relying on the last child,
+		// so adding a new section (e.g. the site-visibility-badge toggle) does
+		// not remove the spacing between the sections above it.
+		+ .site-visibility-settings-slotfill-section {
 			margin-top: 16px;
 		}

@@ -128,5 +131,11 @@
 				}
 			}
 		}
+
+		// The badge toggle is its own top-level section, so drop the left indent
+		// that nested sub-option toggles use.
+		.site-visibility-settings-slotfill-section-visibility-badge {
+			margin-left: 0;
+		}
 	}
 }
diff --git a/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php b/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php
index 72d598042af..8984f46ec65 100644
--- a/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php
+++ b/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php
@@ -40,6 +40,7 @@ class LaunchYourStore {
 			'woocommerce_coming_soon'      => array( 'yes', 'no' ),
 			'woocommerce_store_pages_only' => array( 'yes', 'no' ),
 			'woocommerce_private_link'     => array( 'yes', 'no' ),
+			'woocommerce_feature_site_visibility_badge_enabled' => array( 'yes', 'no' ),
 		);

 		$event_data = array();
@@ -123,6 +124,7 @@ class LaunchYourStore {
 				'woocommerce_store_pages_only' => get_option( 'woocommerce_store_pages_only' ),
 				'woocommerce_private_link'     => get_option( 'woocommerce_private_link' ),
 				'woocommerce_share_key'        => get_option( 'woocommerce_share_key' ),
+				'woocommerce_feature_site_visibility_badge_enabled' => get_option( 'woocommerce_feature_site_visibility_badge_enabled', 'yes' ),
 			);
 		}

diff --git a/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonAdminBarBadge.php b/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonAdminBarBadge.php
index cef7f52908a..fdc89a7c813 100644
--- a/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonAdminBarBadge.php
+++ b/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonAdminBarBadge.php
@@ -4,14 +4,20 @@ declare( strict_types = 1 );

 namespace Automattic\WooCommerce\Internal\ComingSoon;

-use Automattic\WooCommerce\Utilities\FeaturesUtil;
-
-
 /**
  * Adds hooks to add a badge to the WordPress admin bar showing site visibility.
  */
 class ComingSoonAdminBarBadge {

+	/**
+	 * Check if the site visibility badge is enabled.
+	 *
+	 * @return bool
+	 */
+	private function is_badge_enabled(): bool {
+		return 'yes' === get_option( 'woocommerce_feature_site_visibility_badge_enabled', 'yes' );
+	}
+
 	/**
 	 * Sets up the hooks.
 	 *
@@ -44,8 +50,7 @@ class ComingSoonAdminBarBadge {
 	 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
 	 */
 	public function site_visibility_badge( $wp_admin_bar ) {
-		// Early exit if LYS feature is disabled.
-		if ( ! FeaturesUtil::feature_is_enabled( 'site_visibility_badge' ) ) {
+		if ( ! $this->is_badge_enabled() ) {
 			return;
 		}

@@ -82,8 +87,7 @@ class ComingSoonAdminBarBadge {
 	 * @internal
 	 */
 	public function output_css() {
-		// Early exit if LYS feature is disabled.
-		if ( ! FeaturesUtil::feature_is_enabled( 'site_visibility_badge' ) ) {
+		if ( ! $this->is_badge_enabled() ) {
 			return;
 		}

diff --git a/plugins/woocommerce/src/Internal/Features/FeaturesController.php b/plugins/woocommerce/src/Internal/Features/FeaturesController.php
index 5177ff130e8..1b748415324 100644
--- a/plugins/woocommerce/src/Internal/Features/FeaturesController.php
+++ b/plugins/woocommerce/src/Internal/Features/FeaturesController.php
@@ -358,7 +358,7 @@ class FeaturesController {
 					'woocommerce'
 				),
 				'enabled_by_default'           => true,
-				'disable_ui'                   => false,
+				'disable_ui'                   => true,
 				'skip_compatibility_checks'    => true,
 				'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
 				'is_experimental'              => false,