Hide site visibility badge when "Launch Your Store" feature is disabled (#51159)

* Fix: put site visibility badge behind the launch your store feature flag

* Add changelog
This commit is contained in:
Chi-Hsuan Huang 2024-09-06 10:39:55 +08:00 committed by GitHub
parent a7b957dbce
commit 0ef7d95aff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Put site visibility badge behind the launch your store feature flag

View File

@ -4,6 +4,8 @@ declare( strict_types = 1 );
namespace Automattic\WooCommerce\Internal\ComingSoon;
use Automattic\WooCommerce\Admin\Features\Features;
/**
* Adds hooks to add a badge to the WordPress admin bar showing site visibility.
*/
@ -27,6 +29,11 @@ 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 ( ! Features::is_enabled( 'launch-your-store' ) ) {
return;
}
$labels = array(
'coming-soon' => __( 'Coming soon', 'woocommerce' ),
'store-coming-soon' => __( 'Store coming soon', 'woocommerce' ),
@ -60,6 +67,11 @@ class ComingSoonAdminBarBadge {
* @internal
*/
public function output_css() {
// Early exit if LYS feature is disabled.
if ( ! Features::is_enabled( 'launch-your-store' ) ) {
return;
}
if ( is_admin_bar_showing() ) {
echo '<style>
#wpadminbar .quicklinks #wp-admin-bar-woocommerce-site-visibility-badge {