- This topic has 1 reply, 2 voices, and was last updated 5 years, 2 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Sort Woocommerce search results by category
Tagged: sort by category, woocommerce
Hi!
I want the results on this search form to always be sorted by product category
https://www.thejar.sitiosatumedida.com/menu
However, I didn’t see the product category as a sorting option
Thanks for your help
If data terms are stored as a taxonomy (product category is a taxonomy), they cannot be sorted, as taxonomy data are stored as serialized data (multiple terms, like an array) per post (which term in the array would you sort by?). Even if only one term per post is used, WordPress still stores them like this.
You would need to make a custom field (using a plugin like Advanced Custom Fields or a similar plugin) and allocate a value you can sort by, but, be warned, if a post does not have a value in this field, then it will not appear at all in the results if you use the field to order by. Custom fields can store data as single values or serialized data, so only those fields set to store the data as single values can be sorted.