Hello, my site is datempl.com. I have theme enfold and I want to customize my search result page. I want to search the result page exactly like the product page and I don’t want it to show the posts, only woocommerce products.
like this https://i.ibb.co/nnLs469/Screenshot-2022-02-19-164354.png
Hey Edgar,
Thank you for the inquiry.
The search results can be limited to products only but the layout that you are after will require modifications that are beyond the scope of support. You may need to hire a freelance developer to help you with the modification.
To limit the search results to products, just add this code in the functions.php file.
// show products in the search results
function avf_search_filter_pages($query) {
if ($query->is_search) {
$query->set('post_type', 'product');
$query->set( 'wc_query', 'product_query' );
}
return $query;
}
add_filter('pre_get_posts','avf_search_filter_pages');
Please register an account to the forum using your purchase code.
// https://kriesi.at/support/register/
Best regards,
Ismael