A Woocommerce search results page is just a page with a custom page template to give users more information for searching your site. Different Woocommerce themes feature different template files. Some include a search.php template file. This is not a search page, it is merely a template that displays the search results. There is also a template file called searchform.php. This is a template file that is often included in the sidebar of many themes and generates the search box form. If there isn’t one in your theme, you can easily copy it from the Default theme.
Why edit the search results page?
Many of your website visitors will want to find more information about you, your business, or your products. If they hit a blank page after typing a query into your search bar, however, chances are they will leave your site. This is especially true if they are used to Google or a similar search engine.
When one of your readers types a word or phrase into the search box on your Woocommerce site, they’ll see a page listing all the content that matches their query. This is known as a search results page. Of course, an internal search results page is different from the results you would see on a search engine like Google. For one thing, the internal page will only list items that are available within your site, rather than across the entire internet.
Visitors come to your website with certain expectations. While they aren’t looking for the same results they would get from Google, they may expect to see similar features. This can include suggested spellings, content suggestions based on their initial search, and more.
Having a customized search results page can keep your readers engaged with your site and its content, even when their searches come up dry. Plus, you’ll be providing your readers with everything they expect from a standard search engine. By mimicking popular search engines, you can also lower bounce rates on your site.
How to Customize Your Woocomerce Search Results Page
The versatility of WordPress enables you to easily customize your search results. You can use code to alter the search.php file, for example, or you can use a plugin. Of course, the latter method is much easier, but for the sake of completeness, both methods will be covered here.
Edit the search.php file
There are several options you can use to customize your Woocommerce search results page. While you could always dive into the search.php code (though this is best left to experienced users comfortable with PHP and CSS coding), there are several plugins you can use to implement similar changes. Finding the functionality that works best will depend on you and your site. Small personal sites may benefit from free plugins, while larger sites might need a premium solution.
To do this manually you will need to start by creating a child theme.
Next, create a search.php file in your brand new child theme and copy over the code from your old theme (you can find this by either opening up these files on your server via FTP, or from your WordPress dashboard under Appearance > Editor > Search.php). Now you can replace the default title in your child theme’s search.php with the following:
<h1 class="search-title"> <?php echo $wp_query->found_posts; ?> <?php _e( 'Search Results Found For', 'locale' ); ?>: "<?php the_search_query(); ?>" </h1>
This will display the title with the count of the posts found followed by the term that was searched. So it would look something like “15 Search Results Found For My Search Query”.
If you are looking for a simpler method to add a Woocommerce search results page, then follow the steps below.
Use WP Fastest Site Search Plugin
With the help of this Woocommerce product search plugin, the product search results within your store will be as relevant as possible for your potential customers. It is easy to set up and is highly customizable.
- Install WP fastest site search plugin from WordPress plugin store.
- Go to https://cse.expertrec.com/newuser?platform=wordpress.
- Enter your Woocommerce website URL and click on next->
- The crawl will start in the background.
- Login to your WordPress admin panel.
- In your left panel you must be able to see ExpertRec’s WordPress plugin, click on that.
- Get your site ID (or) API key from your ExpertRec control panel ( here ).
- Copy-paste your site id in your WordPress control panel and click on save changes.
- Make sure you have upgraded to a paid plan before 15 days of the free trial. (Price begins at 9 USD per month)
- That’s it! Your brand new Woocommerce search box is up and running! From the ExpertRec control panel, you can customize the appearance of your Woocommerce search results page easily.
If you face any difficulty while using the plugin method, then check out this article which explains how to add search to a website without the use of a plugin. It will give the same results as the plugin and will enable you to edit the Woocommerce search results page.