Remove options from the sort by for Woocommerce products page.

You can remove certain ways to sort product by simply unsetting a few options from the sort menu. Add the following to your theme’s functions.php page. The available options are listed in the comments above the function.

// Modify the default WooCommerce orderby dropdown
//
// Options: menu_order, popularity, rating, date, price, price-desc
function my_woocommerce_catalog_orderby( $orderby ) {
    unset($orderby["rating"]);
    unset($orderby["popularity"]);
    return $orderby;
}
add_filter( "woocommerce_catalog_orderby", "my_woocommerce_catalog_orderby", 20 );

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 34 = 39