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

Automattic\WooCommerce\Admin\API\Reports\Coupons\Stats

Segmenter::get_product_related_totals_segments() protected WC 1.0

Calculate segments for totals where the segmenting property is bound to product (e.g. category, product_id, variation_id).

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

Хуков нет.

Возвращает

Массив.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_product_related_totals_segments( $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $totals_query, $unique_orders_table );
$segmenting_selections(массив) (обязательный)
SELECT part of segmenting SQL query--one for 'product_level' and one for 'order_level'.
$segmenting_from(строка) (обязательный)
FROM part of segmenting SQL query.
$segmenting_where(строка) (обязательный)
WHERE part of segmenting SQL query.
$segmenting_groupby(строка) (обязательный)
GROUP BY part of segmenting SQL query.
$segmenting_dimension_name(строка) (обязательный)
Name of the segmenting dimension.
$table_name(строка) (обязательный)
Name of SQL table which is the stats table for orders.
$totals_query(массив) (обязательный)
Array of SQL clauses for totals query.
$unique_orders_table(строка) (обязательный)
Name of temporary SQL table that holds unique orders.

Код Segmenter::get_product_related_totals_segments() WC 4.7.1

<?php
protected function get_product_related_totals_segments( $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $totals_query, $unique_orders_table ) {
	global $wpdb;

	// Product-level numbers and order-level numbers can be fetched by the same query.
	$segments_products = $wpdb->get_results(
		"SELECT
					$segmenting_groupby AS $segmenting_dimension_name
					{$segmenting_selections['product_level']}
					{$segmenting_selections['order_level']}
				FROM
					$table_name
					$segmenting_from
					{$totals_query['from_clause']}
				WHERE
					1=1
					{$totals_query['where_time_clause']}
					{$totals_query['where_clause']}
					$segmenting_where
				GROUP BY
					$segmenting_groupby",
		ARRAY_A
	); // WPCS: cache ok, DB call ok, unprepared SQL ok.

	$totals_segments = $this->merge_segment_totals_results( $segmenting_dimension_name, $segments_products, array() );
	return $totals_segments;
}