How to manipulate with search data options
Question: Is it possible to show the products filtered by default on load by a certain taxonomy
Answer: yes, do next:
- open your current theme file functions.php
- on the same bottom of the file add next code
if (is_front_page()) { add_filter('woof_get_request_data', 'my_woof_get_request_data'); } function my_woof_get_request_data($request) { $request['product_cat'] = 'music'; //$request['product_cat']='music,posters'; return $request; }
- Use comma if you need more welcome taxonomies
It is just an example-question, by your own logic you can always can add any data in search request …
Remember: is_front_page() function doesn work in AJAX mode!
Example about how to show always ‘In Stock products only’ in the search results:
add_filter('woof_get_request_data', 'my_woof_get_request_data'); function my_woof_get_request_data($data){ $data['stock']='instock'; return $data; }
Troubles? Ask for Support!