How can I list best selling products in woocommerce

后端 未结 2 1868
误落风尘
误落风尘 2021-02-04 08:12

I would like to consider best-selling product in this loop :

 \'product\', \'posts_per_page\' => 1, \'product_         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 08:44

    Solution 1: Add This plugin WP woocommerce best selling products by category

    Solution 2: For retrieving the best buying products in WooCommerce we are using wp_query manipulation with meta_key as “total_sales” and orderby “meta_value_num”. In short we are displaying products as per the total sales number.Here is the code for this

     'product',
        'meta_key' => 'total_sales',
        'orderby' => 'meta_value_num',
        'posts_per_page' => 1,
    );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post(); 
    global $product; ?>
    
    
    
    

提交回复
热议问题