diff --git a/includes/admin/settings/class-wc-settings-advanced.php b/includes/admin/settings/class-wc-settings-advanced.php index 8fbcb5956b6..5056d4fdba8 100644 --- a/includes/admin/settings/class-wc-settings-advanced.php +++ b/includes/admin/settings/class-wc-settings-advanced.php @@ -42,6 +42,7 @@ class WC_Settings_Advanced extends WC_Settings_Page { 'webhooks' => __( 'Webhooks', 'woocommerce' ), 'legacy_api' => __( 'Legacy API', 'woocommerce' ), 'woocommerce_com' => __( 'WooCommerce.com', 'woocommerce' ), + 'features' => __( 'Features', 'woocommerce' ), ); return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections ); @@ -397,6 +398,28 @@ class WC_Settings_Advanced extends WC_Settings_Page { ), ) ); + } elseif ( 'features' === $current_section ) { + $settings = apply_filters( + 'woocommerce_settings_features', + array( + array( + 'title' => __( 'Features', 'woocommerce' ), + 'type' => 'title', + 'desc' => __( 'Start using new features that are being progressively rolled out to improve the store management experience.', 'woocommerce' ), + 'id' => 'features_options', + ), + array( + 'title' => __( 'Home Screen', 'woocommerce' ), + 'desc' => __( 'Displays analytical insights, inbox notifications, and handy shortcuts in a single screen', 'woocommerce' ), + 'id' => 'woocommerce_homescreen_enabled', + 'type' => 'checkbox', + ), + array( + 'type' => 'sectionend', + 'id' => 'features_options', + ), + ) + ); } return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section ); diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index f3f0a6b7e45..81e60ed4876 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -297,6 +297,7 @@ class WC_Install { self::maybe_enable_setup_wizard(); self::update_wc_version(); self::maybe_update_db_version(); + self::maybe_enable_homescreen(); delete_transient( 'wc_installing' ); @@ -341,6 +342,17 @@ class WC_Install { return $missing_tables; } + /** + * Check if the homepage should be enabled and set the appropriate option if thats the case. + * + * @since 4.3.0 + */ + private static function maybe_enable_homescreen() { + if ( self::is_new_install() && ! get_option( 'woocommerce_homescreen_enabled' ) ) { + add_option( 'woocommerce_homescreen_enabled', 'yes' ); + } + } + /** * Reset any notices added to admin. *