WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Admin\API\Reports\Taxes\Stats

DataStore::update_sql_query_params() protected WC 1.0

Updates the database query with parameters used for Taxes Stats report

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

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->update_sql_query_params( $query_args );
$query_args(array) (required)
Query arguments supplied by the user.

Code of DataStore::update_sql_query_params() WC 6.1.0

protected function update_sql_query_params( $query_args ) {
	$taxes_where_clause     = '';
	$order_tax_lookup_table = self::get_db_table_name();

	if ( isset( $query_args['taxes'] ) && ! empty( $query_args['taxes'] ) ) {
		$allowed_taxes       = implode( ',', $query_args['taxes'] );
		$taxes_where_clause .= " AND {$order_tax_lookup_table}.tax_rate_id IN ({$allowed_taxes})";
	}

	$order_status_filter = $this->get_status_subquery( $query_args );
	if ( $order_status_filter ) {
		$taxes_where_clause .= " AND ( {$order_status_filter} )";
	}

	$this->add_time_period_sql_params( $query_args, $order_tax_lookup_table );
	$this->total_query->add_sql_clause( 'where', $taxes_where_clause );

	$this->add_intervals_sql_params( $query_args, $order_tax_lookup_table );
	$this->interval_query->add_sql_clause( 'where', $taxes_where_clause );
	$this->interval_query->add_sql_clause( 'select', $this->get_sql_clause( 'select' ) . ' AS time_interval' );
	$this->interval_query->add_sql_clause( 'where_time', $this->get_sql_clause( 'where_time' ) );
}