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' ); - } /**