WooCommerce Search By SKU — A Quick Fix Using Google Custom Search Engine

The WordPress built-in search has always had its issues. WooCommerce comes with its own product search widget which can be used by customers on the public-facing website but it too has significant limitations. For example, it’s not possible to search the product catalog by SKU.

We recently encountered this limitation first-hand when consulting with our client Prism Design over a customer service issue relating to their titanium jewellery website.

In this article we’ll look at the benefit of using SKU’s in your product catalog and an unconventional way of addressing the lack of search by SKU on the front-end of a WooCommerce website.

What’s a SKU?

Let’s clear this one up first. SKU stands for stock-keeping unit. It is an identification, usually alphanumeric, of a particular product that allows tracking for inventory purposes. It’s pronounced ‘skyew’ (not ‘skoo’ — I got told off for saying that once!)

The Importance of adding SKU’s to products

In a recent post on the WooCommerce blog, Nicole Kohler points out that adding SKU’s to products is a good idea. It’s helpful for both customers and staff who are trying to provide them with a level of service. A specific product is identified quickly if a SKU is associated with it.

This is great advice but there is a problem. Out of the box, WooCommerce product search does not include search by SKU. Yes, you read that correctly.

If you take the time to set up all those lovely SKU’s for your products, by default, they cannot be used in product search on the front-end of your WooCommerce website.

And that could be a real problem.

But who searches by SKU anyway?

Your customers

One of the best uses of Google search is finding ‘that thing’ you want by searching it’s product number or SKU. The search results show a handy list of sites that stock it. All you have to do is click through to the site that has the best price.

So, for some savvy customers, knowing the product number or SKU of the particular item can save a lot of time. Great.

But, when those customers come to your website, armed with a product number or SKU, and try the same type of search, they’ll get no results.

So Google can find your stuff, but your own website can’t. Crazy, right?

Your staff

OK, it’s true, not every customer will come to your website and start searching by SKU but your staff might consider it a real benefit.

It’s likely that not every member of your staff has access to the WordPress administration area of your website where search by SKU is supported. In a customer service situation, where the customer is on the phone with a query about that product they just bought, wouldn’t it be great of the member of staff could use the website as a resource (without logging in) to search for and find the product in question, by SKU?

WooCommerce Search And What To Do About It

Currently (WooCommerce version 2.6.4), you can only use search for WooCommerce SKUs (both parent product SKUs and variation SKUs) in the administration area of your website (the “Products” list).
 
The same search functionality is not available on the public-facing site. Customers cannot search for product SKUs to return a list of products. If customers search for all or part of a SKU, and the search query isn’t contained anywhere else on the site, they’ll get no results.

It’s a problem you won’t know you have until you run up against it. Then it’s a problem.

To find a solution (as with many other shortcomings in the WordPress / WooCommerce ecosystem), you’ll need to start researching your way through the many third party add-ons, extensions and plugins which exist to bring that functionality into your website. SearchWP has a good one and there’s a useful round-up of some of the other options for improving WordPress search here.

Most of those are paid solutions. We wanted to provide our client with a powerful but free alternative to help solve their problem.

The Client’s problem

Our client had a simple and straightforward request.

There are some staff in the office who take calls from customers about specific products for sale on the company website (ti2titanium.com). All products in the WooCommerce catalog are variable products. Without logging in to the admin area of the website, staff need to be able to search and find products using product SKU.

End result: staff are better able to deal with customer queries. Customers and staff spend less time on the phone. Win, win.

In this case, customers were unlikely to search by SKU on the client’s website so there was no need to enhance WooCommerce product search with a third party extension.

Since Google is the best search engine mankind has ever produced and has already indexed every piece of product data on the client’s website (including the SKU, because that information is visible on the product pages), why not just use that?

Introducing Google Custom Search Engine

Google Custom Search Engine logo

Custom Search Engine (CSE) is a little known utility that Google offers for free. It allows you to setup a custom Google search engine which is restricted to searching one or more websites you specify.

Because it uses the Google search index, it is able to return results when searched by SKU (and anything else for that matter). What’s more, because it’s Google, the results show lightning-fast!

You can access the search engine you create via a custom URL or, if required, embed it into your site as a complete replacement for the native search widget (this option will need some knowledge of code).

Here’s a quick video overview of Google CSE:

The URL for your custom search engine is likely to be long and cumbersome, so, just for fun, why not create a bit.ly shortlink instead.

Then just bookmark it in your web browser and share with the team. No login required. Done and done!

What makes this a good solution?

Google is (obviously) a far better search tool than the one that ships with WordPress. It doesn’t care how the data elements are defined on your site, it treats them all as “searchable”. It’s fast, available to anyone with a browser (no login required) and it’s free to use.

Adding new products to the store inventory?

There may be a delay when publishing new products and the CSE may not show them immediately, but at least you can use it to help determine whether they’ve been added to the Google search index.

If they haven’t, then it’s time to jump into Google Search Console and use the crawl tool to ‘fetch’ and ‘add to index’ (you are using Search Console, aren’t you?).

Final thoughts

So there you have it. WordPress native search is not great and WooCommerce product search widget has its limitations.

Yes, there are many add-ons available which will plug missing gaps in functionality but sometimes problem-solving combined with a little lateral thinking leads to an effective solution which doesn’t involve installing yet another plugin to your website.

How are you using Google Custom Search Engine in your business?