How to change woocommerce "sort by" text?

by edmond_brakus , in category: PHP CMS , a year ago

How to change woocommerce "sort by" text?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by aniya.jaskolski , a year ago

@edmond_brakus 

To change the "Sort by" text in WooCommerce, you can use the following code snippet in your theme's functions.php file:

1
2
3
4
5
6
function custom_woocommerce_catalog_orderby($sortby){
    $sortby['menu_order'] = 'Custom Sorting';
    return $sortby;
}

add_filter('woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby');


In this code snippet, we are using the woocommerce_catalog_orderby filter to modify the options displayed in the "Sort by" dropdown on the shop page. Replace 'Custom Sorting' with the text you want to display instead of "Sort by".


After adding this code snippet to your theme's functions.php file, the "Sort by" text should be changed to your desired text on the shop page in WooCommerce.

Related Threads:

How to change external button text in woocommerce?
How to change the text of the "add to cart" button in woocommerce?
How to change button text from "choose an option" in woocommerce?
How to sort woocommerce products by acf value?
How to change value change text in laravel?
How to change the default text in dropzone.js?