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

Segmenter::get_segment_selections_order_level()protectedWC 1.0

Returns column => query mapping to be used for order-related product-level segmenting query (e.g. orders_count when segmented by category).

Method of the class: Segmenter{}

No Hooks.

Return

Array. Column => SELECT query mapping.

Usage

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

Segmenter::get_segment_selections_order_level() code WC 7.3.0

protected function get_segment_selections_order_level( $coupons_lookup_table ) {
	$columns_mapping = array(
		'coupons_count' => "COUNT(DISTINCT $coupons_lookup_table.coupon_id) as coupons_count",
		'orders_count'  => "COUNT(DISTINCT $coupons_lookup_table.order_id) as orders_count",
	);

	return $columns_mapping;
}