Forums › Forums › Search & Filter Pro › Order terms for taxonomy
Tagged: order sorting taxonomy
- This topic has 4 replies, 2 voices, and was last updated 5 years, 10 months ago by
Anonymous.
-
Anonymous(Private) July 4, 2019 at 12:51 pm #215572
I’m working on a webshop using the S&F plugin to filter the products by attributes. Therefor I have a couple of attribute (taxonomy) fields to filter the products.
This works fine, except for one thing. I can’t get the right sorting for the attribute values. I have some attributes with a lot of numeric values, these are all sorted alfabetical which results in something like
100
112
14
18
200
234I would like to sort these attribute values in a numeric order. I already set this right in the attribute itself, and in S&F I left the ‘Order terms by’ option to default. Still I get an alfabetical order. When I change this option to something different, I do not see any changes on the frontend.
How can I fix this?
I already checked in my theme and other plugins that would do something with the order, but that’s not the case.
Thanks in advance!
Trevor(Private) July 4, 2019 at 5:04 pm #215599It is because Product Attributes in WooCommerce are stored as Taxonomies in WordPress, and Taxonmies are textual data, and thus only sorted alphabetically, not numerically. If they were stored as Custom Fields (for example with the ACF plugin), they could be stored as numbers, and then sorted numercially.
Given that your products are in place, the only way to resolve this is for you to custom code the form to sort them numerically, using this filter:
https://searchandfilter.com/documentation/action-filter-reference/#filter-input-object
-
AuthorPosts