Archived topic
Woocommerce: Calling different custom archive product template for searches
1 reply · Started by Max on July 20, 2018
I am using the following snippet in my functions.php file to call a custom template for my Woo shop page. It is working fine.
add_filter( 'template_include', 'custom_shop_page_template_include', 50, 1 );
function custom_shop_page_template_include( $template ) {
if( is_shop() ) {
$template = get_stylesheet_directory() . '/woocommerce/archive-product-custom-shop-page.php';
}
return $template;
}
However, this template also gets called for a search with "no products displayed".
How can I modify the above snippet so that the results from a search are displayed in a different template:
If shop = product-archive-custom-shop-page.php
If search = product-archive-custom-search-page.php
Hi Max,
This sounds like more a question for WooCommerce' support.
Have you checked with them?
They should be more familiar with how their template tags work.