Support » Plugin: Ajaxy Live Search » How to make search result page to display woocommerce products?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey,

    Most likely, you need to edit search.php file in your theme. The location and the name of the template might depend on your theme though, but in most cases it’s that one. You can either enter custom code there or simply load a template into it, like so:

    	get_template_part('woocommerce/archive', 'product');

    This would work if you have a woocommerce folder in your theme and in it you have archive-product.php in that folder. This should make it look like your product category by default.

    More info on get_template_part function here:


    Thanks for your help.
    But I don’t know how to custom code inside search.php or load a template into it.
    I tried to follow your steps:
    1. Create a woocommerce folder in my theme and copy archive-product.php to it, like mytheme/woocommerce/archive-product.php
    2. I use twenty thirteen template search.php
    3. Then I just change “<?php get_template_part( ‘content’, get_post_format() ); ?>” to the code you mentioned <?php
    get_template_part(‘woocommerce/archive’, ‘product’);
    4. I upload edited search.php, but then the search result page display list of products(same products in look, and didn’t display like woocommerce shop page or category page) and sidebar, footer were messed up.

    May you give me more advice?
    Thanks again.

    Well, it totally depends on what you want it to look like and on a theme that you’re using. You can either try loading a different template there or write your own template from scratch. archive-product.php is pretty much just a loop of your products. Of course it gets tricky if you don’t know how to make a template, but in that case you’d either have to learn it or hire someone. This plugin only helps with ajax results, but doesn’t provide tools to customize your search result page or a special template for it. Maybe there’s a plugin that does that though.

    A loop of my products will be enough for me, but the point is that one row with only one product…
    You can have a look at this link:

    I’d like to display 4 products in one row, like in category page.

    That’s because your <body> doesn’t have the woocommerce class, so the styles are not applied. This can be fixed either by adjusting the CSS or by adding the class to the body tag via functions.php of your theme. I guess for you the second option would be easier. Just add this to your functions.php:

    // Add custom classes to the body
    add_filter( 'body_class', 'my_custom_body_classes' );
    function my_custom_body_classes( $classes ) {
    	if ( is_search() ){
    		$classes[] = 'woocommerce'; // show products properly on the search page
    	return $classes;

    Great, it works perfectly as I want, thanks a lot for your kind and useful help.

    Hi dmitry! I was wondering if you could also guide me for the same edit?
    This is my search result page I also want my products to be displayed like my category page
    Do you know how I can do that? I tried the code you gave above but it wont work :S

    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to make search result page to display woocommerce products?’ is closed to new replies.