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 ?
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' ) );