WC_Tracker::get_orders_origins()private staticWC 1.0

Get orders origin details.

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

Хуков нет.

Возвращает

Массив.

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

$result = WC_Tracker::get_orders_origins();

Код WC_Tracker::get_orders_origins() WC 7.1.0

private static function get_orders_origins() {
	global $wpdb;

	$orders_origin = $wpdb->get_results(
		"
		SELECT
			meta_value as origin, COUNT( DISTINCT ( orders.id ) ) as count
		FROM
			$wpdb->posts orders
		LEFT JOIN
			$wpdb->postmeta order_meta ON order_meta.post_id = orders.id
		WHERE
			meta_key = '_created_via'
		GROUP BY
			meta_value;
		"
	);

	$orders_by_origin = array();
	foreach ( $orders_origin as $origin ) {
		$orders_by_origin[ $origin->origin ] = (int) $origin->count;
	}

	return array( 'created_via' => $orders_by_origin );
}