I would like to consider best-selling product in this loop :
\'product\', \'posts_per_page\' => 1, \'product_
I had a hard time trying to get a list of best selling product through the standard loop. But none of the solutions from here and other stackoverflow posts with the same problem do not work for me. Finally I get result that solve my problem through the custom query to data base.
global $wpdb;
$order_totals = $wpdb->get_results( "SELECT kp_posts.ID FROM kp_posts INNER JOIN kp_postmeta ON ( kp_posts.ID = kp_postmeta.post_id ) WHERE 1=1 AND ( kp_postmeta.meta_key = 'total_sales' ) AND kp_posts.post_type = 'product' AND (kp_posts.post_status = 'publish') GROUP BY kp_posts.ID ORDER BY kp_postmeta.meta_value+0 DESC, kp_posts.post_date DESC LIMIT 0, 16" );
foreach ( $order_totals as $value ) {
$product = wc_get_product( $value->ID );
echo $product->get_title();
}