Remove some elements from filter "Sort by"
-
Hi,
Sorry for all the questions but I’m setting my store up and running, hope just bother you guys for a week and then you’ll never hear from me again.
I would like to remove some elements (for example, “Default”, “Popularity”) from the Sort by filter.
I think it’s made via a functions.php code but so far haven’t been able to make it work.
Thanks!!
OK I already found the solution.
In case someone else is looking, this worked for me:
function my_woocommerce_catalog_orderby( $orderby ) {
unset($orderby["menu-order"]);
unset($orderby["popularity"]);
unset($orderby["rating"]);
return $orderby;
}
add_filter( "woocommerce_catalog_orderby", "my_woocommerce_catalog_orderby", 20 );
Also if you would like to set one as default, this works:
// Set date as default order
function default_orderby() {
return('date');
}
add_filter( "woocommerce_default_catalog_orderby", "default_orderby", 20 );
Hi,
Great, we are glad that you have found the solution.
Regards