Change “Default Sorting” Dropdown Option to “Sort By Relevance” in WooCommerce

Woocommerce platform

Default sorting is not exactly user-friendly for customers visiting your e-commerce store. For most customers, “Sort by Relevance” is easier to understand, and comes across as “more welcoming” to visitors, particularly those who don’t shop online often.

Ideally, you want your dropdown to default to something like the screenshot shown below of one of my clients’ websites.

WooCommerce Drop Down


/**
* Changing "Default Sorting" to "Sort by Relevance" on Shop and Product Category pages
**/
function sip_update_sorting_name( $catalog_orderby ) {
$catalog_orderby = str_replace("Default sorting", "Sort by Relevance", $catalog_orderby);
return $catalog_orderby;
}
add_filter( 'woocommerce_catalog_orderby', 'sip_update_sorting_name' );
add_filter( 'woocommerce_default_catalog_orderby_options', 'sip_update_sorting_name' );

If you prefer, you can change “Sort by Relevance” in the code above to something else that fits your needs. Tested with WooCommerce 3.3.0 and above.