A wholesale buyer has last month’s invoice open, types the part number into your shop’s search box and gets “No products were found matching your selection.” The product is there, in stock, with that exact SKU. WooCommerce simply doesn’t look at SKUs when customers search.
To let customers search products by SKU in WooCommerce, you either add a short snippet that matches exact SKUs, or use a search plugin that also finds partial SKUs, variation SKUs, attribute values and typos. Both work. They don’t find the same things, and the difference matters most for the buyers who reorder by part number.
We tested it in a real store (WooCommerce 11.2.1, a block theme, simple and variable products). Below you’ll see which product fields WooCommerce searches, why the admin search finds SKUs when the shop search doesn’t, the results of 8 test searches with each fix, and the steps for both.
Does WooCommerce search products by SKU?
Only in wp-admin. The search box your customers use doesn’t check SKUs, not for simple products and not for variations. In our test store, the Ribbed Ceramic Vase comes in 6 variations with SKUs such as LH-RCV-MEDIUM-SAND. Searching the shop for that SKU found nothing:

The same happened with the parent SKU (LH-RCV), a simple product’s SKU (LH-RCV-T) and part of a SKU (RCV). The shop search uses WordPress’s own search, which matches words in 3 places only: the product name, the description and the short description (see the WP_Query search parameter). The SKU is stored elsewhere, so it is never checked. Attributes aren’t checked either. We gave the Leather Sling Chair a Color attribute of Cognac, a word that appears nowhere else on the product, and a search for “cognac” found nothing.
A quick check for your own store: if a SKU happens to be written in a product’s description, the search finds that product through the description, not the SKU. That’s why SKU search sometimes seems to work for a few products and not for others.

Why the SKU search works in wp-admin but not in your shop
This is the part that confuses store owners: you type a SKU in Products > All Products and the product shows up, so you assume customers can do the same. They can’t. The admin list uses a separate WooCommerce search that also checks the SKU column, variation SKUs and the GTIN, UPC, EAN or ISBN field, and it matches part of a SKU too. Searching wp-admin for LH-RCV-MEDIUM-SAND lists the parent product:

So when a customer says “your search is broken” and your own test in wp-admin works, test it on the storefront, logged out, before you look for anything else.
Snippet or plugin: what each fix finds
We ran the same 8 searches on the storefront 3 times: with WooCommerce alone, with the snippet from the next section, and with our Product Search plugin. A search that finds exactly one product sends the customer straight to that product page (WooCommerce does this on its own), so “Found” here means the right product page opened or showed in the results.
| Customer types | What it is | WooCommerce alone | Snippet | Product Search |
|---|---|---|---|---|
| LH-RCV-T | Exact SKU of a simple product | Nothing found | Found | Found |
| lh-rcv-t | Same SKU in lowercase | Nothing found | Found | Found |
| LH-RCV-MEDIUM-SAND | Variation SKU | Nothing found | Parent product | Parent product |
| LH-RCV | SKU that starts other SKUs | Nothing found | 1 product | 2 products (LH-RCV and LH-RCV-T) |
| RCV | Part of a SKU | Nothing found | Nothing found | 2 products |
| LH-RCV-T vase | SKU plus a word | Nothing found | Nothing found | Found |
| cognac | Attribute value only (the chair’s Color) | Nothing found | Nothing found | Found |
| stonware | Typo for “stoneware” | Nothing found | Nothing found | 2 products |
The snippet covers the most common case: a customer who pastes or types the full SKU. The plugin covers the rest: half-remembered part numbers, SKUs with an extra word, attribute values and typos. Neither one opens the exact variation: a variation SKU leads to the parent product page, where the customer still picks Medium and Sand.
Option 1: add exact SKU search with a snippet
If your customers always search the full SKU, this is enough. It adds the product whose SKU matches the search exactly to the normal search results, and for a variation SKU it adds the parent product. Paste it with a code snippets plugin such as Code Snippets, or in your child theme’s functions.php:
// Let the shop search find a product by its exact SKU or variation SKU.
add_filter( 'posts_search', function ( $search, $query ) {
global $wpdb;
if ( is_admin() || ! $query->is_main_query() || ! $query->is_search() || '' === $search ) {
return $search;
}
$product_id = wc_get_product_id_by_sku( trim( $query->get( 's' ) ) );
if ( ! $product_id ) {
return $search;
}
$product = wc_get_product( $product_id );
if ( $product && $product->get_parent_id() ) {
$product_id = $product->get_parent_id(); // A variation: show its parent product.
}
return str_replace( 'AND (((', "AND (({$wpdb->posts}.ID = " . absint( $product_id ) . ') OR ((', $search );
}, 20, 2 );
We tested it on WooCommerce 11.2.1 with the searches in the table above. Uppercase or lowercase doesn’t matter, spaces around the SKU are ignored, and it also works with WordPress’s Search block, which searches the whole site rather than only products. Here the plain Search block, with the snippet active, finds the vase from its variation SKU:

What the snippet doesn’t do:
- Exact matches only. “RCV” or “LH-RCV-T vase” find nothing, and “LH-RCV” finds one product even though LH-RCV-T starts the same way.
- No live suggestions. Customers see results after they press Enter, not while they type.
- No attributes, GTINs or typos. Those need more code, and attribute search in particular is a bigger job than SKUs.
Anything that isn’t a complete SKU, such as a SKU plus a word, simply runs WooCommerce’s normal search. And products you’ve set to hidden from search under Catalog visibility stay hidden, because WooCommerce filters them out of the search separately.
A note on Business Bloomer’s popular “Search Products By SKU” snippet: it uses the same idea but only runs when the search form sends post_type=product. WooCommerce’s Product Search block sends it; WordPress’s plain Search block doesn’t. In our test, a search from the plain Search block (no post_type) found nothing with that snippet, while the version above found the product.
You’ll also come across the free Search by SKU for WooCommerce plugin on WordPress.org. Its page says it was last updated 5 years ago and tested up to WordPress 5.7, with a warning that it hasn’t been tested with the latest 3 major WordPress releases. We wouldn’t add an unmaintained plugin to a store that takes payments; the snippet above covers the same common case in a few lines you can read.
Option 2: search by SKU, attributes and typos with a plugin
When your buyers reorder by part number, they rarely type it perfectly. They type the first half, leave out the dashes or add the product type. Product Search builds its own index of each product’s name, SKU and variation SKUs, descriptions, categories, tags, brands and attributes. It matches the start of words, forgives typos and shows matching products with image, price and SKU as the customer types.
Set it up
- Install and activate the plugin. It indexes your products in the background; small stores are done right away.
- Go to WooCommerce > Settings > Search. Under Search in, check that SKU, variations included and Attributes, such as colour or size are listed. Both are on by default.
- Keep Theme search checked. The plugin’s search box then replaces your theme’s and WooCommerce’s search boxes, including the Search and Product Search blocks. To add a box somewhere else, use the Product search (live) block or the
[pspr_search]shortcode. - Under Live suggestions, leave SKU checked so customers see the SKU under each product name and know they have the right part.
- Remove the snippet from Option 1 if you added it, then search for a few SKUs on your storefront while logged out.

The Product Search docs cover the other settings: how much each field counts toward relevance, synonyms, redirects and leaving categories out of search.
What customers see
On a test page where we added the plugin’s search box with the [pspr_search] shortcode (the line above the box is our own text), typing “LH-RCV” shows both products whose SKU starts with it, with the SKU under the name, before the customer presses Enter:

A variation SKU finds its product too. The suggestion shows the parent product with its own SKU and links to the product page, where the customer chooses the size and glaze:

SKU searches have 2 more details worth knowing. The SKU is indexed in parts and as a whole without dashes: in our test store, “rcv-t” opened the Ribbed Vase, Tall, and “LHRCVT” listed it. And a part number that doesn’t exist doesn’t always end in “nothing found”. By default the plugin shows products with some of the words when none has all of them, so LH-SWP-10-IN (a planter size we don’t sell) listed the Stoneware Planter first, followed by every other product whose SKU starts with LH.
How to search by attribute in WooCommerce
Attribute search has the same cause as SKU search: attribute values are stored as terms (global attributes) or in the product’s meta (custom attributes), not in the product’s text, so the shop search never sees them. A customer who types “cognac chair” in a default store gets nothing, even though the Leather Sling Chair’s Color is Cognac.
There are 2 ways to handle it. If customers browse rather than type, filters are the right tool: WooCommerce’s own Product Filters blocks, or our Product Filters plugin for swatches and filter pages, let them narrow a category by size or color. If they type, the search itself has to read attributes. With Product Search, attributes are searched by default, global attributes and custom ones per product:

Attributes count less toward relevance than names and SKUs by default (20 against 60 and 50), so a product with “cognac” in its name ranks above one that only has Cognac as its color. You can change that under Relevance.
Make part numbers easy to search
A few habits make SKU search work better, whichever fix you choose:
- Give every variation its own SKU. A variation without one uses the parent’s SKU, so a customer can’t search for that size or color by part number.
- Use one SKU pattern. A fixed prefix and the same separator (LH-RCV-MEDIUM-SAND, not a mix of dashes, dots and spaces) makes partial searches predictable.
- Print the SKU where buyers will copy it from. Invoices, order emails and packing slips are where repeat buyers look for it.
- Test logged out, on the storefront. The admin search finds SKUs on its own, so it tells you nothing about what customers see.
With Product Search, also check the report under Products > Search now and then. Searches that found nothing can be part numbers that aren’t yours, such as a manufacturer’s number from the box. Each row has links to add a synonym or a redirect, and a redirect can send that number straight to your product page:

If your buyers order many SKUs at once, a search box is the slow way to do it. Quick Order Form & Variation Grid gives them a form with SKU search, variations included, and lets them paste a list such as “LH-GAJ, 24” or reorder from past orders.
FAQ
Does WooCommerce have a setting to search by SKU?
No. There is no option in WooCommerce settings that adds SKUs to the shop search. The admin Products list searches SKUs on its own, which is why it can look like the feature exists. For the storefront you need a snippet or a search plugin.
Can customers search by GTIN, UPC or EAN?
Not with WooCommerce alone: the shop search ignores the GTIN, UPC, EAN or ISBN field, though the admin search checks it. With Product Search, add _global_unique_id under Custom fields and add Custom fields to Search in. To search more than one field, separate the keys with commas. We tested this with a 13-digit GTIN on the product and it was found. A GTIN set on a single variation wasn’t found in our test, because the custom fields are read from the main product only. If your barcodes are in a field of your own, see how custom product fields work and enter that field’s key instead.
Will a variation SKU open the right variation?
No, not with the snippet, the plugin or WooCommerce’s admin search. All 3 lead to the parent product, because WooCommerce shows variations on the parent’s page. The customer then picks the options on that page.
Why does a SKU search skip the results page?
When a product search finds exactly one product, WooCommerce opens that product page instead of a results page with one item. This only happens on product searches (the ones that send post_type=product); a search from WordPress’s plain Search block shows a normal results page. For an exact SKU that is usually what the customer wants. Developers can turn it off with the woocommerce_redirect_single_search_result filter.
Why can’t my newly added products be found by SKU?
With WooCommerce alone, no product can be found by SKU, new or old. With a search plugin that uses an index, new products are added when they are saved. Products created by an import that writes straight to the database can be missed: in Product Search, use Rebuild index under WooCommerce > Settings > Search after such an import.
Which fix to choose
Start by searching your storefront, logged out, for one simple SKU and one variation SKU. If customers only ever paste full SKUs, the snippet above fixes it in 5 minutes. If they type parts of part numbers, mix in product words, search by size or color or make typos, Product Search covers all of that with live suggestions, and the search report shows what they still can’t find. Try it in the live demo from the product page, and if you have a question about your catalog, open a support ticket.



