Automattic\WooCommerce\Admin\API\Reports\Stock\Stats

DataStore::get_product_count()privateWC 1.0

Get product count for the store.

Method of the class: DataStore{}

No Hooks.

Return

Int. Product count.

Usage

// private - for code of main (parent) class only
$result = $this->get_product_count();

DataStore::get_product_count() code WC 9.3.3

private function get_product_count() {
	$query_args              = array();
	$query_args['post_type'] = array( 'product', 'product_variation' );
	$query                   = new \WP_Query();
	$query->query( $query_args );
	return intval( $query->found_posts );
}