146

Would you like your customers to be able to search for your WooCommerce products using a SKU code?

Because SKU codes uniquely identify your products, searching for them will help users quickly find exactly what they are looking for. The challenge is that SKU search is not enabled in WooCommerce by default.

In this article, we’ll show you how to enable search by product SKU in WooCommerce.

Why Enable Search by Product SKU in WooCommerce?

To run a successful WooCommerce store, it’s important for your customers to easily find the products they wish to purchase. To make this simple, most eCommerce platforms use SKUs, or Stock Keeping Units, to uniquely identify each product.

If a customer knows the SKU for the product they wish to purchase, why not let them search for the SKU to instantly find the correct product in your store?

The problem is that WooCommerce SKUs are stored in custom fields, and these are not indexed or included in search results by default. As a result, searching for the SKU won’t help.

Let’s take a look at how to solve this problem by enabling users to search by SKU in WooCommerce using a product search plugin.

How to Enable Search by Product SKU in WooCommerce

The first thing you need to do is install and activate the SearchWP plugin. You’ll need at least the Pro plan to access WooCommerce integration. For more details, see our step-by-step guide on how to install a WordPress plugin.

SearchWP is the best custom search plugin for WordPress and is used by over 30,000 websites. It lets you customize the search algorithm, add live Ajax search for real-time results, and more.

Upon activation, you need to visit the SearchWP » Settings page and switch to the ‘Support’ tab to enter your license key. You can find it in your downloads area for your account on the SearchWP site.

Paste Your SearchWP License Key

Next, you need to install and activate the WooCommerce Integration extension for SearchWP.

You’ll find this in the downloads area for your account on the SearchWP website, too. You should install it as you would install any other WordPress plugin.

Install the WooCommerce Integration Extension

Now you are ready to customize the SearchWP search engine to index your product SKUs.

Simply go to the SearchWP » Settings page and make sure you’re on the ‘Engines’ tab. Once there, you need to click the ‘Sources & Settings’ button.

Click on the 'Sources & Settings' Button

This will bring up a popup where you should make sure the checkbox next to ‘Products’ is checked. This will allow SearchWP to index your WooCommerce products.

Also, if you’d also like to include WooCommerce product reviews in your search results, then make sure you check the ‘Comments’ box, too. That’s because product reviews are actually stored as comments in WooCommerce.

Check the Products and Comments Boxes

Once you’ve done that, click on the ‘Done’ button to close the popup and get ready to add the SKU search.

Now you need to scroll down to the ‘Products’ section. Notice that by default, the plugin will only look at the product title, content (description), slug, and excerpt (short description).

Click the 'Add/Remove Attributes' Button in the Products Section

You can extend SearchWP’s reach to include SKUs by clicking on the ‘Add/Remove Attributes’ button. This will bring up a popup where you can include specific custom fields and taxonomies in searches.

You’ll need to type ’SKU’ into the Custom Fields field and choose the _sku option from the dropdown menu. This will add SKUs to WooCommerce search results pages.

Select _sku From the Custom Field Drop Down Menu

You can now click the ‘Done’ button.

Notice that there is now a new section labeled ‘Custom Fields’ with the _sku field underneath.

Slide the SKU Relevance Slider to the Right

To begin with, the relevance slider will be set all the way to the left, which means that SKU search results will be given the lowest priority in search results.

Since SKUs are an important way to find your products, you should move the _sku slider all the way to the right, as you can see above.

When you’re done, go ahead and click on the ‘Save Engines’ button at the top of the screen to save your settings.

Click the 'Save Engine' Button

SearchWP will then start rebuilding your search index in the background. It may take a few minutes to complete, but after that, you will be able to search your WooCommerce store by product SKU.

SearchWP will automatically use any search forms on your online store, so there is no need to take any additional steps if you have them on your site already.

However, if you need to add a search form, then see our step-by-step guide on how to create a custom WordPress search form. This will also teach you how to style the results page using custom CSS.

Now you can go to your WooCommerce store to try out the search feature.

In our demo store, the long sleeve tee has the SKU ‘woo-long-sleeve-tee.’ When we search for that SKU, the correct product is displayed.

Preview of Product SKU Search in WooCommerce

To learn more about improving search on your online store, see our guide on how to make a smart WooCommerce product search.

We hope this tutorial helped you learn how to enable product search by SKU in WooCommerce. You may also want to learn how to create a WooCommerce popup to increase sales, or check out our list of the best WooCommerce plugins to grow your online store.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Enable Search by Product SKU in WooCommerce first appeared on WPBeginner.

Want to receive personalized offers?

Allow notifications to get real-time updates about your shopping cart and who knows, you may even receive a sweet discount code 😊

Maybe later