Snippet to make search forms to search only for products
Simply copy the repository code to your functions.php to make your sitewide search results show products.
/** | |
*Search only by products | |
*/ | |
function searchfilter($query) { | |
if ($query->is_search && !is_admin() ) { | |
$query->set('post_type',array('product')); | |
} | |
return $query; | |
} |