Tagged: Product, search, woocomerce
Hi, currently when using the search, results are formatted as a simple list with no images shown for WooCommerce products that match the search.
Search URLs look like this :
http://www.shop.com/?s=whaisearched
If i manually change it to this :
http://www.shop.com/?s=whaisearched&post_type=product
Results are formatted nicely in a grid layout with product images shown.
Question is : how can i force this layout to be used whenever a search is performed ? (especially from menu search icon)
Hey radugidei,
Thank you for using Enfold.
This is possible but the search form will be limited to products. It won’t be able to fetch other post types. Please add this in the functions.php file:
// add post type product
add_action('ava_frontend_search_form','ava_frontend_search_form_mod');
function ava_frontend_search_form_mod()
{
echo '<input type="hidden" name="post_type" value="product">';
}
Best regards,
Ismael
Thank you Ismael, that works perfectly – topic can be closed now !
Hi,
Glad we could help :)
Best regards,
Nikko