Modifying WooCommerce Product Sort Options

You can easily modify the WooCommerce product sort options to remove any unnecessary sort options for your WooCommerce store.
Simply add this to your theme’s functions.php and customise to suit your needs.

function custom_woocommerce_catalog_orderby( $sortby ) {
unset($sortby['rating']);
unset($sortby['price']);
unset($sortby['desc']);
 
return $sortby;
}
add_filter( 'woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby' );

 

You can change the following options;

  • menu_order – Default sorting
  • popularity –  Sort by popularity
  • rating – Sort by average rating
  • date – Sort by newness
  • price – Sort by price: low to high
  • price-desc – Sort by price: high to low

 

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

Leave a Reply

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