Remove WooCommerce default product sorting options

Published on Jun 23, 2015 & tagged in WordPress, WooCommerce

In default, the WooCommerce product sorting drop down in archive pages has 6 sorting options,

  1. Default Sorting.
  2. Sort by popularity.
  3. Sort by average rating.
  4. Sort by newness.
  5. Sort by price: low to high.
  6. Sort by price: high to low.

Now we are going to remove some of these default product sorting options in our shop using WooCommerce filter hook, woocommerce_catalog_orderby.

// Just unset the item you don't required.

function my_woocommerce_catalog_orderby( $orderby ) {
	unset($orderby["menu_order"]);	// Remove "Default sorting"
	unset($orderby["popularity"]);	// Remove "Sort by popularity"
	unset($orderby["rating"]);		// Remove "Sort by average rating"
	unset($orderby["date"]);		// Remove "Sort by newness"
	unset($orderby["price"]);		// Remove "Sort by price: low to high"
	unset($orderby["price-desc"]);	// Remove "Sort by price: high to low"
	return $orderby;
}
add_filter( "woocommerce_catalog_orderby", "my_woocommerce_catalog_orderby", 20 );

Do you need any help on WordPress & WooCommerce?

I'm happy to help you. Just fill the form on contact page & I will get back to you within few hours.

Recent Posts

  1. Get current store details - Magento 1.9
  2. Simple ways to improve page conversion on product page
  3. Encrypt Email Addresses - PHP
  4. The add_image_size() function - WordPress best practices
  5. Remove page title using filter - WordPress