From the course: WordPress: Customizing WooCommerce Themes

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Customize the sorting menu

Customize the sorting menu - WordPress Tutorial

From the course: WordPress: Customizing WooCommerce Themes

Start my 1-month free trial

Customize the sorting menu

- [Male Instructor] One of the useful features included with WooCommerce is the ability to sort the products. There are a lot of options available by default. Sorting by popularity, average rating, newness, and sorting by price. But as with everything else, these can be customized to suit your store. We don't have any reviews on our site right now, so letting customers sort by review, or by average rating, is a waste of time. For right now, until we get a few reviews on our site, we're going to remove that option. I'm going to switch to my Code Editor, and I'm going to write a bit of functionality to remove that option. We're going to start with add filter, woocommerce, catalog, orderby. And then, we're going to write the function that modifies this: hplussports, catalog, orderby. And we're going to set the priority to 20. Now, we just need to write this function: function, copy, paste. This filter does accept one parameter, and that's the orderby parameter, which has all the…

Contents