Forums › Forums › Search & Filter Pro › ACF Pro + S&F
Tagged: V3
- This topic has 5 replies, 2 voices, and was last updated 6 years, 2 months ago by Trevor.
-
Anonymous(Private) September 24, 2018 at 3:19 pm #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(Private) September 24, 2018 at 4:21 pm #189271It 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(Private) September 24, 2018 at 7:56 pm #189302I 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.
Anonymous(Private) September 28, 2018 at 9:19 pm #189724If 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(Private) October 1, 2018 at 12:49 pm #189771Setting 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).
-
AuthorPosts