
Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on November 23, 2021, 10:27
Hello
What is the difference between Total Sales and Popularity? - In fact, this is the same thing, but sorting has a different implementation.
Please drop me exact link to the issue
Hello
What is the difference between Total Sales and Popularity? - In fact, this is the same thing, but sorting has a different implementation.
Please drop me exact link to the issue

Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on November 24, 2021, 10:25
Hello
I checked it - https://c2n.me/4e6lldd - products are sorted correctly
Hello
I checked it - https://c2n.me/4e6lldd - products are sorted correctly

Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on November 25, 2021, 10:18
Hello
What criteria is the Total Sales ordering using? - Each product has a meta field - total_sales. And my plugin sorts by this value correctly - https://c2n.me/4e7cfcY
Hello
What criteria is the Total Sales ordering using? - Each product has a meta field - total_sales. And my plugin sorts by this value correctly - https://c2n.me/4e7cfcY

Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on November 26, 2021, 11:22
Hello
Sort by Total Sales:
this is added to the query arguments
$args['order'] = 'desc';
$args['orderby'] = 'meta_value_num';
$args['meta_key'] = 'total_sales';
Sort by popularity: This is added to SQL request
' wc_product_meta_lookup.total_sales DESC, wc_product_meta_lookup.product_id DESC ';
But as you can see, the sort uses the same fields.
Hello
Sort by Total Sales:
this is added to the query arguments
$args['order'] = 'desc';
$args['orderby'] = 'meta_value_num';
$args['meta_key'] = 'total_sales';
Sort by popularity: This is added to SQL request
' wc_product_meta_lookup.total_sales DESC, wc_product_meta_lookup.product_id DESC ';
But as you can see, the sort uses the same fields.