WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Automattic\WooCommerce\Admin\API

Leaderboards::get_customers_leaderboard() public WC 1.0

Get the data for the customers leaderboard.

{} Это метод класса: Leaderboards{}

Хуков нет.

Возвращает

Null. Ничего.

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

$Leaderboards = new Leaderboards();
$Leaderboards->get_customers_leaderboard( $per_page, $after, $before, $persisted_query );
$per_page(число) (обязательный)
Number of rows.
$after(строка) (обязательный)
Items after date.
$before(строка) (обязательный)
Items before date.
$persisted_query(строка) (обязательный)
URL query string.

Код Leaderboards::get_customers_leaderboard() WC 4.7.0

<?php
public function get_customers_leaderboard( $per_page, $after, $before, $persisted_query ) {
	$customers_data_store = new CustomersDataStore();
	$customers_data       = $per_page > 0 ? $customers_data_store->get_data(
		array(
			'orderby'      => 'total_spend',
			'order'        => 'desc',
			'order_after'  => $after,
			'order_before' => $before,
			'per_page'     => $per_page,
		)
	)->data : array();

	$rows = array();
	foreach ( $customers_data as $customer ) {
		$url_query    = wp_parse_args(
			array(
				'filter'    => 'single_customer',
				'customers' => $customer['id'],
			),
			$persisted_query
		);
		$customer_url = wc_admin_url( '/analytics/customers', $url_query );
		$rows[]       = array(
			array(
				'display' => "<a href='{$customer_url}'>{$customer['name']}</a>",
				'value'   => $customer['name'],
			),
			array(
				'display' => wc_admin_number_format( $customer['orders_count'] ),
				'value'   => $customer['orders_count'],
			),
			array(
				'display' => wc_price( $customer['total_spend'] ),
				'value'   => $customer['total_spend'],
			),
		);
	}

	return array(
		'id'      => 'customers',
		'label'   => __( 'Top Customers - Total Spend', 'woocommerce' ),
		'headers' => array(
			array(
				'label' => __( 'Customer Name', 'woocommerce' ),
			),
			array(
				'label' => __( 'Orders', 'woocommerce' ),
			),
			array(
				'label' => __( 'Total Spend', 'woocommerce' ),
			),
		),
		'rows'    => $rows,
	);
}