Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

Products::has_products()public staticWC 1.0

Check if the store has any user created published products.

Method of the class: Products{}

No Hooks.

Return

true|false.

Usage

$result = Products::has_products();

Products::has_products() code WC 9.0.1

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;
}