Posted on

WooCommerce: Remove, Rename, Add “Default Sorting” Options @ Shop

We’ve seen in the past how to completely remove the “Default Sorting” dropdown that shows in the WooCommerce Shop, Category and Product Archive pages.

Sometimes, however, you might just need to remove one of the default options, rename a sorting option accordingly to your needs or even add a brand new sorting method. As usual, a few lines of PHP are sufficient to achieve anything, thanks to WooCommerce hooks and filters.

Remove, Rename or Add Options to the WooCommerce “Default Sorting” Dropdown

PHP Snippet #1: Remove a Default Sorting Option @ WooCommerce Shop

* @snippet 	Remove Default Sorting Option @ WooCommerce Shop
* @how-to 	Watch tutorial @
* @sourcecode
* @author 	Rodolfo Melogli
* @testedwith 	WooCommerce 3.4.3

add_filter( 'woocommerce_catalog_orderby', 'bbloomer_remove_sorting_option_woocommerce_shop' );

function bbloomer_remove_sorting_option_woocommerce_shop( $options ) {
	unset( $options['rating'] );	
	return $options;

// Note: you can unset another default sorting option... here's the list:
// 'menu_order' => __( 'Default sorting', 'woocommerce' ),
// 'popularity' => __( 'Sort by popularity', 'woocommerce' ),
// 'rating'     => __( 'Sort by average rating', 'woocommerce' ),
// 'date'       => __( 'Sort by newness', 'woocommerce' ),
// 'price'      => __( 'Sort by price: low to high', 'woocommerce' ),
// 'price-desc' => __( 'Sort by price: high to low', 'woocommerce' ),

PHP Snippet #2: Rename a Default Sorting Option @ WooCommerce Shop

* @snippet 	Rename a Default Sorting Option @ WooCommerce Shop
* @how-to 	Watch tutorial @
* @sourcecode
* @author 	Rodolfo Melogli
* @testedwith 	WooCommerce 3.4.3

add_filter( 'woocommerce_catalog_orderby', 'bbloomer_rename_sorting_option_woocommerce_shop' );

function bbloomer_rename_sorting_option_woocommerce_shop( $options ) {
	$options['price'] = __( 'Sort by price (asc)', 'woocommerce' );	
	return $options;

PHP Snippet #3: Add a Default Sorting Option @ WooCommerce Shop

* @snippet 	Add a Default Sorting Option @ WooCommerce Shop
* @how-to 	Watch tutorial @
* @sourcecode
* @author 	Rodolfo Melogli
* @testedwith 	WooCommerce 3.4.3

// 1. Create new product filter

add_filter( 'woocommerce_get_catalog_ordering_args', 'bbloomer_sort_by_name_woocommerce_shop' );

function bbloomer_sort_by_name_woocommerce_shop( $args ) {
	$orderby_value = isset( $_GET['orderby'] ) ? wc_clean( (string) wp_unslash( $_GET['orderby'] ) ) : wc_clean( get_query_var( 'orderby' ) );
	if ( 'name' == $orderby_value ) {
		$args['orderby'] = 'title';
		$args['order'] = 'asc';
		$args['meta_key'] = '';
	return $args;

// 2. Add new product filter to Sorting dropdown

add_filter( 'woocommerce_catalog_orderby', 'bbloomer_load_custom_woocommerce_catalog_sorting' );

function bbloomer_load_custom_woocommerce_catalog_sorting( $options ) {
$options['name'] = 'Sort by name (asc)';
return $options;

Where to add this code?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such delicate files - if you need more guidance, please take a look at my free WooCommerce Customization video tutorial.

Does this snippet still work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free videos, tutorials and tips!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP
  • woocommerce-customize-shop-page-PHP
  • woocommerce-advanced-customization
  • how-to-edit-woocommerce-cart
  • woocommerce-customize-checkout-page-PHP
  • woocommerce-email-customization
  • woocommerce-conditional-logic

Rodolfo Melogli

Author, WooCommerce expert, WordCamp speaker and Internet marketer, Rodolfo Melogli has worked as a WooCommerce freelancer since 2011. He helps entrepreneurs and developers overcome their WooCommerce nightmares :) Rodolfo is the organiser of WordCamp Dublin, the Dublin WooCommerce Meetup, the Dublin Ecommerce Meetup and the Dublin WordPress Meetup. He enjoys interacting with people, travelling and chasing tennis & soccer balls. Of course, he loves pizza too.

6 thoughts on “WooCommerce: Remove, Rename, Add “Default Sorting” Options @ Shop

  1. Is there a way to change the order of the sorting options?
    That would be awesome!

    1. Hello Miriam – thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  2. The same that lottie but for my bookmarks. Thanks!! ๐Ÿ™‚

    1. Ahah ๐Ÿ™‚

  3. just what I was looking for

    your website is now my home page!!!

    1. Nice ๐Ÿ™‚

Questions? Feedback? Support? Leave your Comment Now!
If you're writing code, please wrap it between: [php] code_here [/php]

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.