Automattic\WooCommerce\Admin\API\Reports

DataStore::add_orderby_order_clause()protectedWC 1.0

Add order by order SQL clause.

Method of the class: DataStore{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->add_orderby_order_clause( $query_args, $sql_query );
$query_args(array) (required)
Parameters supplied by the user.
$sql_query(SqlQuery) (required) (passed by reference — &)
Query object.

DataStore::add_orderby_order_clause() code WC 7.3.0

protected function add_orderby_order_clause( $query_args, &$sql_query ) {
	if ( isset( $query_args['order'] ) ) {
		$sql_query->add_sql_clause( 'order_by', esc_sql( $query_args['order'] ) );
	} else {
		$sql_query->add_sql_clause( 'order_by', 'DESC' );
	}
}