$_GET[ Task::ACTIVE_TASK_TRANSIENT ] ) ); if ( $task_id !== $this->get_id() || ! $this->is_complete() ) { return; } WCAdminAssets::register_script( 'wp-admin-scripts', 'onboarding-load-sample-products-notice', true ); } /** * Delete the product count transient used in has_products() method to refresh the cache. * * @return void */ public static function delete_product_count_cache() { delete_transient( self::PRODUCT_COUNT_TRANSIENT_NAME ); } /** * Check if the store has any user created published products. * * @return bool */ public static function has_products() { $product_counts = get_transient( self::PRODUCT_COUNT_TRANSIENT_NAME ); if ( false !== $product_counts && is_numeric( $product_counts ) ) { return (int) $product_counts > 0; } $product_counts = self::count_user_products(); set_transient( self::PRODUCT_COUNT_TRANSIENT_NAME, $product_counts ); return $product_counts > 0; } /** * Count the number of user created products. * Generated products have the _headstart_post meta key. * * @return int The number of user created products. */ private static function count_user_products() { $args = array( 'post_type' => 'product', 'post_status' => 'publish', 'fields' => 'ids', 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query 'relation' => 'OR', array( 'key' => '_headstart_post', 'compare' => 'NOT EXISTS', ), array( 'key' => '_edit_last', 'compare' => 'EXISTS', ), ), ); $products_query = new \WP_Query( $args ); return $products_query->found_posts; } }
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\Products" not found in /htdocs/wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskList.php:148 Stack trace: #0 /htdocs/wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskLists.php(260): Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList->__construct(Array) #1 /htdocs/wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskLists.php(139): Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskLists::add_list(Array) #2 /htdocs/wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskLists.php(73): Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskLists::init_default_lists() #3 /htdocs/wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Init.php(36): Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskLists::init() #4 /htdocs/wp-content/plugins/woocommerce/src/Admin/Features/Features.php(138): Automattic\WooCommerce\Admin\Features\OnboardingTasks\Init->__construct() #5 /htdocs/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Admin\Features\Features::load_features('') #6 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #7 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #8 /htdocs/wp-settings.php(704): do_action('init') #9 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #10 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #11 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #12 /htdocs/index.php(17): require('/htdocs/wp-blog...') #13 {main} thrown in /htdocs/wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskList.php on line 148