Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors

StoredStateSetupForProducts::are_there_products()private staticWC 1.0

Are there products query.

Method of the class: StoredStateSetupForProducts{}

No Hooks.

Return

true|false.

Usage

$result = StoredStateSetupForProducts::are_there_products();

StoredStateSetupForProducts::are_there_products() code WC 9.0.1

private static function are_there_products() {
	$query    = new \WC_Product_Query(
		array(
			'limit'    => 1,
			'paginate' => true,
			'return'   => 'ids',
			'status'   => array( 'publish' ),
		)
	);
	$products = $query->get_products();
	$count    = $products->total;

	return $count > 0;
}