Forums Forums Search & Filter Pro Sort Woocommerce search results by category

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #267562

    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

    Trevor
    #267585

    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.

Viewing 2 posts - 1 through 2 (of 2 total)