This topic has 2 replies, 2 voices, and was last updated 3 years, 5 months ago ago by Rose Tyler
How can I change the sorting for search results? The search results are now showing in random order but I want to change it to price ascending.
Hello,
There is no such option, by default.
After the next update you will be able to use next code in your child-theme/functions.php
add_filter('etheme_ajax_search_products_query', function ($args){
$args['meta_key'] = '_price';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'ASC';
return $args;
});
Order param will take products from low to high price but if you use ‘DESC’ then you will show products from high to low prices
To have it now – you can add this code http://prntscr.com/13gurhw
$args = apply_filters('etheme_ajax_search_products_query', $args);
to your plugins/et-core-plugin/app/models/customizer/class-ajax-search.php
and custom above to your child theme
Regards
The issue related to '‘search result default sorting’' has been successfully resolved, and the topic is now closed for further responses