WC_API_Customers::get_customers_count()publicWC 2.1

Get the total number of customers

Метод класса: WC_API_Customers{}

Хуков нет.

Возвращает

Массив|WP_Error.

Использование

$WC_API_Customers = new WC_API_Customers();
$WC_API_Customers->get_customers_count( $filter );
$filter(массив)
-
По умолчанию: array()

Список изменений

С версии 2.1 Введена.

Код WC_API_Customers::get_customers_count() WC 7.7.0

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() ) );
}