Display template other than search.php for WooCommerce search results
-
Hi there,
I have a WooCommerce child theme where I’m using the Search and Filter plugin to filter search terms by product category. When a user selects a product category, the search results use the taxonomy-product_cat.php template and it all looks great.
But when a user searches for just the term and does not select the product category, the results default to search.php and shows results as the regular posts format.
I have filtered the search results from this search bar to be only post-type=”product”. The filtering is working, but I want products to show up like with archive-product.php template.
I’ve been going round and round trying to figure out how to essentially do the following:
If search results page includes post-type=product in the url {
use template like archive-product.php
}
in the functions.php file, search.php and countless others in my child theme.
I know it’s just a matter of me not knowing how all the pieces need to be put together, and I can’t find any information after an exhaustive search to do this one specific thing. Any insight and code examples would be MUCH appreciated at this point ??
Thank you in advance!
- The topic ‘Display template other than search.php for WooCommerce search results’ is closed to new replies.