Forums Forums Search & Filter Pro Order terms for taxonomy

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #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
    234

    I 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
    #215580
    This reply has been marked as private.
    Anonymous
    #215584
    This reply has been marked as private.
    Trevor
    #215599

    It 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

    Anonymous
    #215738

    Ok, but I can sort attributes in a numerical way in WooCommerce, so I would guess that this would also work in a filter of S&F.

    Anyway, I fixed it now with the filter you suggested, so the problem is solved now. Thanks!

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