WordPress at Your Fingertips
function is not described


Segmenter::get_segment_selections_order_level() protected WC 1.0

Returns column => query mapping to be used for order-related order-level segmenting query (e.g. tax_rate_id).

{} 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_order_level( $lookup_table );
$lookup_table(string) (required)
Name of SQL table containing the order-level segmenting info.

Code of Segmenter::get_segment_selections_order_level() WC 6.1.0

protected function get_segment_selections_order_level( $lookup_table ) {
	$columns_mapping = array(
		'tax_codes'    => "COUNT(DISTINCT $lookup_table.tax_rate_id) as tax_codes",
		'total_tax'    => "SUM($lookup_table.total_tax) AS total_tax",
		'order_tax'    => "SUM($lookup_table.order_tax) as order_tax",
		'shipping_tax' => "SUM($lookup_table.shipping_tax) as shipping_tax",
		'orders_count' => "COUNT(DISTINCT $lookup_table.order_id) as orders_count",

	return $columns_mapping;