woocommerce products custom orderby code example
Example: orderby total sales woocommerce
$args = array(
'post_type' => 'shop_order',
'posts_per_page' => 2000,
'orderby' => 'meta_value_num',
'meta_key' => 'total_sales',
),
);
$args = array(
'post_type' => 'shop_order',
'posts_per_page' => 2000,
'orderby' => 'meta_value_num',
'meta_key' => 'total_sales',
),
);