Automattic\WooCommerce\Admin\API\Reports\Stock\Stats
DataStore::get_product_count
Get product count for the store.
Method of the class: DataStore{}
No Hooks.
Returns
Int. Product count.
Usage
// private - for code of main (parent) class only $result = $this->get_product_count();
DataStore::get_product_count() DataStore::get product count code WC 10.3.6
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 );
}