I found this conversation from a few years ago:
https://toolset.com/forums/topic/add-the-ajax-sort-by-price/
At the time, there was no option for front-end sorting. Has that changed?
It would be great to offer a select field that lists options like "sort by price asc, sort by price desc, sort by name, sort by publish date", etc.
Thanks
Yes, you can add front-end sorting to a View of Products. You can choose different sorting criteria like price, post date, and post title. Sorting by views_woo_price is most performant for prices, but you should be aware that this is a calculated value and you must manage those calculations in Toolset > WooCommerce Views > Products Fields for Parametric Searches.
You can also add direction controls for ASC and DESC sorting. Click "Sorting Controls" above the Search and Pagination panel in the View editor to add and configure front-end sorting controls. If you cannot see Search and Pagination, scroll to the top right corner of the screen in the View editor page and click "Screen Options" to enable the panel.
That looks pretty straightforward! There's ALWAYS a way to do it with Toolset....
However, I've got a strange issue. I'm sorting by price, with the price being an ACF number field. It works perfectly, except for ONE item, which is being mis-sorted.
Here's a quick video showing the issue. I'm hoping you might have an idea what's wrong:
hidden link
Thanks
Okay my guess is the sorting algorithm isn't set correctly. When you insert sorting controls, you will choose your custom price field first. Then you'll have the option to choose the sorting algorithm. Your options are usually "as a native custom field", "as a string", or "as a number". You want "as a number" in this case. I would delete the sorting controls you currently have in place and insert them again. Let the system generate the appropriate shortcodes for you, and make sure "as a number" is selected in the popup. I'm attaching screenshots here so you can see what I'm talking about. One is the popup where you can choose the sort algorithm, and the other is the resulting shortcodes from my Search and Pagination panel. Let me know if updating the sorting algorithm and recreating the sorting controls does not solve the problem.