Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Enable Search by Product SKU in WooCommerce

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Would you like your customers to be able to search for your WooCommerce products using an 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.

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.

This is found 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’ under Custom Fields 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

If you’d like to learn more about improving search on your online store, then be sure to take a look at our guide on how to make a smart WooCommerce product search.

Expert Guides on Improving Search in WordPress & WooCommerce

Now that you know how to enable product search by SKU, you may like to see some other articles related to improving search in WordPress and WooCommerce.

We hope this tutorial helped you learn how to enable product search by SKU in WooCommerce. You may also want to see our guide on how to create a WooCommerce popup to increase sales, or our expert pick 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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

1 CommentLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.