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

WC_Tracker::get_order_totals() public WC 1.0

Get order totals

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

Хуков нет.

Возвращает

Массив.

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

$result = WC_Tracker::get_order_totals();

Код WC_Tracker::get_order_totals() WC 4.7.1

<?php
public static function get_order_totals() {
	global $wpdb;

	$gross_total = $wpdb->get_var(
		"
		SELECT
			SUM( order_meta.meta_value ) AS 'gross_total'
		FROM {$wpdb->prefix}posts AS orders
		LEFT JOIN {$wpdb->prefix}postmeta AS order_meta ON order_meta.post_id = orders.ID
		WHERE order_meta.meta_key =  '_order_total'
			AND orders.post_status in ( 'wc-completed', 'wc-refunded' )
		GROUP BY order_meta.meta_key
	"
	);

	if ( is_null( $gross_total ) ) {
		$gross_total = 0;
	}

	$processing_gross_total = $wpdb->get_var(
		"
		SELECT
			SUM( order_meta.meta_value ) AS 'gross_total'
		FROM {$wpdb->prefix}posts AS orders
		LEFT JOIN {$wpdb->prefix}postmeta AS order_meta ON order_meta.post_id = orders.ID
		WHERE order_meta.meta_key =  '_order_total'
			AND orders.post_status = 'wc-processing'
		GROUP BY order_meta.meta_key
	"
	);

	if ( is_null( $processing_gross_total ) ) {
		$processing_gross_total = 0;
	}

	return array(
		'gross'            => $gross_total,
		'processing_gross' => $processing_gross_total,
	);
}