Only skip the store_notices during new install in AS.

This commit is contained in:
Peter Fabian 2020-02-07 11:06:35 +01:00
parent 4c4f9f1164
commit 5fc2e8fba9
2 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ class WC_Admin_Notices {
add_action( 'switch_theme', array( __CLASS__, 'reset_admin_notices' ) ); add_action( 'switch_theme', array( __CLASS__, 'reset_admin_notices' ) );
add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) ); add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) );
add_action( 'wp_loaded', array( __CLASS__, 'hide_notices' ) ); add_action( 'wp_loaded', array( __CLASS__, 'hide_notices' ) );
if ( ! wc_is_running_from_async_action_scheduler() ) { if ( ! WC_Install::is_new_install() || ! wc_is_running_from_async_action_scheduler() ) {
add_action( 'shutdown', array( __CLASS__, 'store_notices' ) ); add_action( 'shutdown', array( __CLASS__, 'store_notices' ) );
} }

View File

@ -319,7 +319,7 @@ class WC_Install {
* @since 3.2.0 * @since 3.2.0
* @return boolean * @return boolean
*/ */
private static function is_new_install() { public static function is_new_install() {
$product_count = array_sum( (array) wp_count_posts( 'product' ) ); $product_count = array_sum( (array) wp_count_posts( 'product' ) );
return is_null( get_option( 'woocommerce_version', null ) ) || ( 0 === $product_count && -1 === wc_get_page_id( 'shop' ) ); return is_null( get_option( 'woocommerce_version', null ) ) || ( 0 === $product_count && -1 === wc_get_page_id( 'shop' ) );