I am using the following two codes to generate a wordpress search and a woo commerce product search? Is there a code to merge theme into one search bar doing both functions?
<?php get_search_form(); ?>
<?php get_product_search_form(); ?>
get_search_from(); covers both.
get_product_search_form() is same as get_search_from() just that it restricts the wordpress search to products only.
If you see the markup of both the functions, there's only one difference. There is an additional post type value set as a product.
<input type="hidden" name="post_type" value="product" />
So,
get_search_from() >> get_product_search_form()
I used the plugin Relevanssi which allows you to include custom post types (including woocommerce products) in the search results along with posts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With