Website Building » WooCommerce » What Is Default Sorting in WooCommerce?

What Is Default Sorting in WooCommerce?

Last updated on January 12, 2023 @ 5:34 pm

When you first install WooCommerce, the default sorting option for products is set to “Sort by popularity”. This means that products with the most sales will be displayed first. While this option may work well for some stores, others may want to change the default sorting to better suit their needs. For example, you may want to sort by “Newness” so that your newest products are displayed first, or by “Price” so that your most expensive products are displayed first.

There are two ways to change the default sorting in WooCommerce. The first method is to go to WooCommerce > Settings > Products > Default product sorting.

From here, you can select the default sorting option that you want from the dropdown menu. The second method is to add a line of code to your functions.php file. You can add the following code:

add_filter( 'woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby' );
function custom_default_catalog_orderby( $orderby ) {
$orderby = "price";
return $orderby;}

This code will change the default sorting to “Sort by price”. You can change “price” to any of the other options listed above (e.g., “newness”, “popularity”, etc. ).

PRO TIP: When you add products to your WooCommerce store, they are automatically sorted by date, with the most recent products appearing first. This is called default sorting.

While this default sorting may be fine in some cases, you may want to give your customers the option to sort products in a different order. For example, you may want to let them sort by price or by name.

To do this, you will need to change the default sorting settings in WooCommerce. Please note that this can be a bit technical, so if you’re not comfortable with making code changes, we recommend that you ask a developer for help.

Drew Clemente

Drew Clemente

Devops & Sysadmin engineer. I basically build infrastructure online.