WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Query::order_by_popularity_post_clauses() public WC 1.0

WP Core does not let us change the sort direction for individual orderby params - https://core.trac.wordpress.org/ticket/17065.

This lets us sort by meta value desc, and have a second orderby param.

{} Это метод класса: WC_Query{}

Хуков нет.




$WC_Query = new WC_Query();
$WC_Query->order_by_popularity_post_clauses( $args );
$args(массив) (обязательный)
Query args.

Код WC_Query::order_by_popularity_post_clauses() WC 5.7.0

public function order_by_popularity_post_clauses( $args ) {
	$args['join']    = $this->append_product_sorting_table_join( $args['join'] );
	$args['orderby'] = ' wc_product_meta_lookup.total_sales DESC, wc_product_meta_lookup.product_id DESC ';
	return $args;