From 4c3d6ffa6b13afb97a5132266909987d3f559e7f Mon Sep 17 00:00:00 2001 From: Chi-Hsuan Huang Date: Fri, 5 Apr 2024 09:20:17 +0800 Subject: [PATCH] Move the LYS feature flag check inside add_lys_default_values() (#46154) * Move the feature flag check to add_lys_default_values method * Add changelog * Revert changes * Fix bug in login functionality --- .../changelog/fix-lys-default-values-actions | 4 ++++ plugins/woocommerce/includes/class-woocommerce.php | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 plugins/woocommerce/changelog/fix-lys-default-values-actions diff --git a/plugins/woocommerce/changelog/fix-lys-default-values-actions b/plugins/woocommerce/changelog/fix-lys-default-values-actions new file mode 100644 index 00000000000..dfa5c6784f2 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-lys-default-values-actions @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Move the feature flag check to add_lys_default_values method diff --git a/plugins/woocommerce/includes/class-woocommerce.php b/plugins/woocommerce/includes/class-woocommerce.php index 038d4c155d3..36647f92410 100644 --- a/plugins/woocommerce/includes/class-woocommerce.php +++ b/plugins/woocommerce/includes/class-woocommerce.php @@ -254,11 +254,8 @@ final class WooCommerce { add_action( 'woocommerce_updated', array( $this, 'add_woocommerce_inbox_variant' ) ); add_action( 'woocommerce_installed', array( $this, 'add_woocommerce_remote_variant' ) ); add_action( 'woocommerce_updated', array( $this, 'add_woocommerce_remote_variant' ) ); - - if ( Features::is_enabled( 'launch-your-store' ) ) { - add_action( 'woocommerce_newly_installed', array( $this, 'add_lys_default_values' ) ); - add_action( 'woocommerce_updated', array( $this, 'add_lys_default_values' ) ); - } + add_action( 'woocommerce_newly_installed', array( $this, 'add_lys_default_values' ) ); + add_action( 'woocommerce_updated', array( $this, 'add_lys_default_values' ) ); // These classes set up hooks on instantiation. $container = wc_get_container(); @@ -318,6 +315,10 @@ final class WooCommerce { * Set default option values for launch your store task. */ public function add_lys_default_values() { + if ( ! Features::is_enabled( 'launch-your-store' ) ) { + return; + } + $is_new_install = current_action() === 'woocommerce_newly_installed'; $coming_soon = $is_new_install ? 'yes' : 'no'; @@ -431,7 +432,6 @@ final class WooCommerce { * The SSR in the name is preserved for bw compatibility, as this was initially used in System Status Report. */ $this->define( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE', 'none' ); - } /**