Support » Plugin: WooCommerce » order by 2 meta field

  • atomrus1993

    (@atomrus1993)


    Hello, i have problem, please can you help me?

    I have field meta key (sort_custom), i need first sort by my field, then order popularity (total_sales)

    my code

    $args = array(
    
    		'orderby'  => array( 
    			'meta_value_num' => 'ASC', 
    			'total_sales' => 'DESC' 
    			),
    		'meta_key' => 'sort_custom'
    
    		);

    it’s doesn’t work!
    if i use “date/title” instead “total_sales, it’s work, but i need work my_field(meta_key) + total_sales, need
    first order my field then sort total_sales

  • You must be logged in to reply to this topic.