Forums Forums Search & Filter Pro ACF Pro + S&F

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #189261

    Hi!

    I’m using WordPress 4.9.8 + Woocommerce 3.4.5 + ACF Pro + Search & Filter Pro. In the Search Form I’m using ACF for filtering the products. Is it possible to set a checkbox as checked by default in the search form? I need to exclude some products from search results by default. Those products will show only if the user uncheck the checkbox.

    Thank you!

    Trevor
    #189271

    It ought to be possible using our Filter Input Object filter, but setting a default there does not seems to trigger and update to the results.

    So, the more reliable way is to write some Custom jQuery javascript that runs on page load. However, the problem with this in your case is that it will always change that field to that value, so I would normally advise to check the if any of the form fields has any value and only run if the form has not been used to filter the results.

    But, in your case, unchecking that option would most likely look like no search had been done, so that will not work either. The only other way I can think to do it is to change any links (menus etc) to that page to a Custom Link and include the full URL plus the query string needed to select that option.

    Anonymous
    #189302

    I can’t do that. I have filters with input type range:slider and the full URL will contain in the query string the minimum and maximum values of the sliders. If I add any new product, this will change the range maximum or minimum value and the URL will exclude this product from search results.

    Trevor
    #189345
    This reply has been marked as private.
    Anonymous
    #189724

    If I go to the page and check that box, the full URL will contain in the query string the minimum and maximum values of the sliders (I have 2 sliders) and the value of the checkbox.
    I found a way to solve this, but I excluded from search results some products. It’ll be nice if we could set the default value of the checkbox…

    Trevor
    #189771

    Setting defaults for controls can be problematic. It is something we are looking to add for V3, but I cannot give any tiemscale as of yet.

    The only other way is to set the search query in the URL on any links to the page (e.g. in menus, as a Custom Link).

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