WordPress at Your Fingertips
function is not described

WC_Tracker::get_product_counts() public WC 1.0

Get product totals based on product type.

{} It's a method of the class: WC_Tracker{}

No Hooks.

Return

Array.

Usage

$result = WC_Tracker::get_product_counts();

Code of WC_Tracker::get_product_counts() WC 5.9.0

public static function get_product_counts() {
	$product_count          = array();
	$product_count_data     = wp_count_posts( 'product' );
	$product_count['total'] = $product_count_data->publish;

	$product_statuses = get_terms( 'product_type', array( 'hide_empty' => 0 ) );
	foreach ( $product_statuses as $product_status ) {
		$product_count[ $product_status->name ] = $product_status->count;
	}

	return $product_count;
}