Automattic\WooCommerce\Internal\Admin\Orders\MetaBoxes
CustomerHistory::get_customer_history
Get the order history for the customer (data matches Customers report).
Метод класса: CustomerHistory{}
Хуков нет.
Возвращает
Массив|null. Order count, total spend, and average spend per order.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_customer_history( $customer_report_id ): ?array;
- $customer_report_id(int) (обязательный)
- The reports customer ID (not necessarily User ID).
Код CustomerHistory::get_customer_history() CustomerHistory::get customer history WC 10.4.2
private function get_customer_history( $customer_report_id ): ?array {
$args = array(
'customers' => array( $customer_report_id ),
// If unset, these params have default values that affect the results.
'order_after' => null,
'order_before' => null,
);
$customers_query = new CustomersQuery( $args );
$customer_data = $customers_query->get_data();
return $customer_data->data[0] ?? null;
}