In Woocommerce Category page default sort dropdown has like below options.
My question is what/how products sort by Popularity ? Not a code What is the measurement ? like if sort Price: Low to High,then we know those product sort Low price to High then How about Popularity ?
In Woocommerce Category page default sort dropdown has like below options.
My question is what/how products sort by Popularity ? Not a code What is the measurement ? like if sort Price: Low to High,then we know those product sort Low price to High then How about Popularity ?
Share Improve this question asked Nov 16, 2018 at 6:09 RikaRika 1131 silver badge6 bronze badges 2- popularity — you can choose this option if you want products to be sorted from most popular to the least popular ones; – vikrant zilpe Commented Nov 16, 2018 at 6:37
- please check this link code:github/woocommerce/woocommerce/blob/… – vikrant zilpe Commented Nov 16, 2018 at 6:39
2 Answers
Reset to default 0'Sort By Popularity' filter sort products based on total sales of product
Well the option Sort by Popularity will sort the products based on Total sales. It means the product will sort from Higher sales to Lower sales.
You can get more idea from below code :-
$args['meta_key'] = 'total_sales';
add_filter( 'posts_clauses', array( $this, 'order_by_popularity_post_clauses' ) );