Website Building » WooCommerce » How Do I Change the Default Sorting Text in WooCommerce?

How Do I Change the Default Sorting Text in WooCommerce?

Last updated on October 1, 2022 @ 9:02 pm

In WooCommerce, the default sorting text is “Sort by popularity,” but you can change this text to anything you want. To do this, you’ll need to edit the following file:

/wp-content/plugins/woocommerce/includes/class-wc-product-query.php

On line 771, you’ll see the following:

$orderby = _x( 'popularity', 'orderby', 'woocommerce' );

All you need to do is change “popularity” to whatever text you want. For example, if you wanted the text to say “Sort by name,” you would change it to this:

PRO TIP: If you are not familiar with code or are not comfortable making changes to your site’s code, we do not recommend making the changes outlined in this article. These changes can be made by a developer or someone with experience working with code. We also do not recommend making these changes on a live site. Always back up your site before making any changes.

$orderby = _x( 'name', 'orderby', 'woocommerce' );

Once you’ve saved your changes, the new text will be displayed on your shop page.

How Do I Change the Default Sorting Text in WooCommerce? You can change the default sorting text in WooCommerce by editing the /wp-content/plugins/woocommerce/includes/class-wc-product-query.php file on line 771.

Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.