WordPress at Your Fingertips
function is not described

WC_API_Customers::get_customers_count() public WC 2.1

Get the total number of customers

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

No Hooks.

Return

Array|WP_Error.

Usage

$WC_API_Customers = new WC_API_Customers();
$WC_API_Customers->get_customers_count( $filter );
$filter(array)
-
Default: array()

Changelog

Since 2.1 Introduced.

Code of WC_API_Customers::get_customers_count() WC 5.7.1

public function get_customers_count( $filter = array() ) {

	$query = $this->query_customers( $filter );

	if ( ! current_user_can( 'list_users' ) ) {
		return new WP_Error( 'woocommerce_api_user_cannot_read_customers_count', __( 'You do not have permission to read the customers count', 'woocommerce' ), array( 'status' => 401 ) );
	}

	return array( 'count' => count( $query->get_results() ) );
}