Reposition The Ordering Dropdown Menu in Woocommere

I am working my way through Woocommerce for a new theme build and really finding out all about its little quirks. I’m quite impressed so far with everything as the woo theme provide hooks for almost anything.

One thing I needed to do was bring the ordering menu from below the page to a more logical position, such as the top right in the content area. By default, the ordering menu is attached to the pagination hook. I understand why they chose this approach as pagination will only ever be used on archives, search results etc but we can make it a bit better by hooking on to another function.

First, we have to unhook the woocommerce_catalog_ordering function from pagination, then check if the page is not the product page (as the menu will still show here), then hook on to woocommerce_before_main_content.

Leave a Reply