WordPress at a glance
function is not described


Segmenter::get_segment_selections_product_level() protected WC 1.0

Returns column => query mapping to be used for product-related product-level segmenting query (e.g. products sold, revenue from product X when segmenting by category).

{} It's a method of the class: Segmenter{}

No Hooks.


Array. Column => SELECT query mapping.


// protected - for code of main (parent) or child class
$result = $this->get_segment_selections_product_level( $products_table );
$products_table(string) (required)
Name of SQL table containing the product-level segmenting info.

Code of Segmenter::get_segment_selections_product_level() WC 5.2.2

protected function get_segment_selections_product_level( $products_table ) {
	$columns_mapping = array(
		'items_sold'       => "SUM($products_table.product_qty) as items_sold",
		'net_revenue'      => "SUM($products_table.product_net_revenue ) AS net_revenue",
		'orders_count'     => "COUNT( DISTINCT $products_table.order_id ) AS orders_count",
		'variations_count' => "COUNT( DISTINCT $products_table.variation_id ) AS variations_count",

	return $columns_mapping;