Forums Forums Search & Filter Pro Option to deactivate search filter

Tagged: 

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

    Hi!

    Is there a way to let the customer activate/deactivate a search filter in the search form?

    My problem:

    I have custom fields for WooCommerce but all products does not fill in the fields. In Search & Replace I hav Post Meta field with Range Number input type. If I set the minimum value to 0 then it will display results from all products that don’t have any value at all. If I set the min value to 1 the it will never display any products that don’t have any value.

    So my thought were to let the visitor activate and deactivate the field depending on if the visitor is looking for products with or without that specific field.

    Trevor
    #240616

    Ah. Range fields will tend to cause some issues like this. We intend to improve the way the range fields work for V3 (due in a few weeks), but for now they work as follows.

    Once a range field is present on a form, and the filter is submitted by a user, the range field values will be added to the query parameters. If a post (in your case products) has no value for that field, it will be omitted from the results. The consequence of this is, if you use a field to populate a range slider, every post MUST have a value entered, even if it is 0. In V3 I think you will be given a choice of how to treat posts that have no value (always include or always exclude).

    It is also possible that we will allow form fields to be ‘deactivated’ and thus not used, but I think the above mentioned when to include empty (NULL) field values might be a better choice.

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