Automattic\WooCommerce\Internal\Admin

CustomerEffortScoreTracks::get_product_count()privateWC 1.0

Get the current published product count.

Method of the class: CustomerEffortScoreTracks{}

No Hooks.

Return

Int. The current published product count.

Usage

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

CustomerEffortScoreTracks::get_product_count() code WC 9.3.3

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

	return $product_count;
}