WC_API_Customers::get_customers()publicWC 2.1

Get all customers

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

Хуков нет.

Возвращает

Массив.

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

$WC_API_Customers = new WC_API_Customers();
$WC_API_Customers->get_customers( $fields, $filter, $page );
$fields(массив)
-
По умолчанию: null
$filter(массив)
-
По умолчанию: array()
$page(int)
-
По умолчанию: 1

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

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

Код WC_API_Customers::get_customers() WC 8.7.0

public function get_customers( $fields = null, $filter = array(), $page = 1 ) {

	$filter['page'] = $page;

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

	$customers = array();

	foreach ( $query->get_results() as $user_id ) {

		if ( ! $this->is_readable( $user_id ) ) {
			continue;
		}

		$customers[] = current( $this->get_customer( $user_id, $fields ) );
	}

	$this->server->add_pagination_headers( $query );

	return array( 'customers' => $customers );
}