WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports\Stock

Controller::add_wp_query_orderby() public WC 1.0

Custom orderby clauses using the lookup tables.

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

No Hooks.

Return

Array. Nothing.

Usage

$result = Controller::add_wp_query_orderby( $args, $wp_query );
$args(array) (required)
Query args.
$wp_query(object) (required)
WP_Query object.

Code of Controller::add_wp_query_orderby() WC 5.3.0

<?php
public static function add_wp_query_orderby( $args, $wp_query ) {
	global $wpdb;

	$orderby = $wp_query->get( 'orderby' );
	$order   = esc_sql( $wp_query->get( 'order' ) ? $wp_query->get( 'order' ) : 'desc' );

	switch ( $orderby ) {
		case 'stock_quantity':
			$args['join']    = self::append_product_sorting_table_join( $args['join'] );
			$args['orderby'] = " wc_product_meta_lookup.stock_quantity {$order}, wc_product_meta_lookup.product_id {$order} ";
			break;
		case 'stock_status':
			$args['join']    = self::append_product_sorting_table_join( $args['join'] );
			$args['orderby'] = " wc_product_meta_lookup.stock_status {$order}, wc_product_meta_lookup.stock_quantity {$order} ";
			break;
		case 'sku':
			$args['join']    = self::append_product_sorting_table_join( $args['join'] );
			$args['orderby'] = " wc_product_meta_lookup.sku {$order}, wc_product_meta_lookup.product_id {$order} ";
			break;
	}

	return $args;
}