Content of the article
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 code1234567891011if (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:
1 2 3 4 5 6 | add_filter('woof_get_request_data', 'my_woof_get_request_data'); function my_woof_get_request_data($data){ $data['stock']='instock'; return $data; } |
