WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports\Customers

DataStore::get_order_count() public WC 1.0

Retrieve the amount of orders made by a customer.

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

No Hooks.

Return

Int|null. Amount of orders for customer or null on failure.

Usage

$result = DataStore::get_order_count( $customer_id );
$customer_id(int) (required)
Customer ID.

Code of DataStore::get_order_count() WC 5.3.0

<?php
public static function get_order_count( $customer_id ) {
	global $wpdb;
	$customer_id = absint( $customer_id );

	if ( 0 === $customer_id ) {
		return null;
	}

	$result = $wpdb->get_var(
		$wpdb->prepare(
			"SELECT COUNT( order_id ) FROM {$wpdb->prefix}wc_order_stats WHERE customer_id = %d",
			$customer_id
		)
	);

	if ( is_null( $result ) ) {
		return null;
	}

	return (int) $result;
}