Shopify Development

Shopify Search Not Finding SKUs? Expert Fixes for Storefront Search

As a Shopify migration expert at Shopping Cart Mover, we often encounter store owners grappling with various technical quirks. One of the most common and frustrating issues that pops up in the Shopify Community forums, and in our client discussions, is when the storefront search mysteriously stops finding products by their SKUs or partial terms. It’s a classic scenario that can severely impact user experience and conversions.

Recently, a store owner named rachaelannewalker highlighted this exact pain point: they had products like "JM-XL1" and "JM-XL2" that previously appeared when searching for "jm-xl." Suddenly, the search only worked if the exact SKU was typed. The kicker? They hadn't made any recent updates to their Dawn theme. Sound familiar? You’re not alone.

Shopify theme code customization for predictive search, showing `predictive-search.js` file being edited to include SKU search.
Shopify theme code customization for predictive search, showing `predictive-search.js` file being edited to include SKU search.

Understanding Shopify's Dual Search Engines

The first step to fixing this issue is understanding a crucial distinction: Shopify actually uses different search engines for your admin panel and your storefront. The search you use to manage products in your Shopify admin is distinct from the one your customers use on your live website. The storefront search is the one that runs through your theme and is subject to its configuration and Shopify's default indexing rules.

When your admin search still surfaces "JM-XL1" for "jm-xl," but your storefront search doesn't, it's a clear indicator that the problem lies with your storefront's indexing or how your theme handles search, rather than an issue with your product data itself. This insight, shared by helpful community member Lumine, is key to diagnosing the problem.

Why Your SKUs Might Be Hiding from Storefront Search

Shopify's default storefront search, especially its predictive search API, has specific behaviors that can lead to SKUs being overlooked:

  • No Guarantee on Partial Matches for SKUs: By default, Shopify's storefront search doesn't always guarantee partial or substring matching on variant SKUs. While it's excellent at searching product titles, vendors, and product types, SKUs often require explicit configuration to be fully searchable in this manner.
  • Hyphenated Terms Get Split: Lumine also highlighted that hyphenated terms (like "jm-xl") can often get split into separate search tokens. So, instead of searching for "jm-xl" as one cohesive unit, the engine might be searching for "jm" AND "xl" independently. If "jm" and "xl" don't appear together in other indexed fields, or if the combination isn't strong enough, your product might not appear.

The predictive search API, by default, typically focuses on a limited set of fields: title, product_type, variants.title, and vendor. If your SKU isn't explicitly included in this scope, it won't be found by the predictive search feature.

Solution 1: The Quick & Easy Fix – Leveraging Product Tags

For a straightforward and non-technical workaround, Lumine's suggestion is incredibly effective: put the value you want to be findable into a field that search actually indexes. The most reliable way to do this is by adding your SKUs as product tags.

How it works: Product tags are inherently indexed by Shopify's storefront search. By adding "JM-XL" as a tag to all products with SKUs like "JM-XL1," "JM-XL2," etc., you ensure that a search for "jm-xl" will return these products. This method doesn't require any code changes and is accessible to all store owners.

Best Practices for Tags:

  • Consistency is Key: Ensure you use consistent tagging conventions across all relevant products.
  • Avoid Tag Bloat: While effective, don't over-tag products. Use tags strategically for search and organization.
  • Consider Automation: For large catalogs, consider using apps or custom scripts to automate tag assignment based on SKU patterns.

Solution 2: Advanced Customization – Modifying Your Theme's Predictive Search

For those comfortable with theme code or working with a developer, a more robust solution involves modifying your theme's JavaScript to explicitly tell the predictive search API to include SKUs in its search scope. This is particularly relevant for themes like Dawn, which utilize the predictive search API.

Community member Tim Tairli provided an excellent solution for Dawn theme users. The core idea is to adjust the query parameters sent to Shopify's predictive search endpoint.

Locating and Modifying the Code (Dawn Theme Example):

In the Dawn theme, you'll typically find the relevant code in the assets/predictive-search.js file. You need to modify the `fetch` request that retrieves search results.

Locate a line similar to this (around line 179 in many Dawn versions):

  fetch(`${routes.predictive_search_url}?q=${encodeURIComponent(searchTerm)}§i {

And change it to include the resources[options][fields] parameter, explicitly adding variants.sku to the list of searchable fields:

fetch(`${routes.predictive_search_url}`
+`?q=${encodeURIComponent(searchTerm)}`
+`§i
+`&${encodeURIComponent("resources[options][fields]=title,product_type,variants.title,vendor,variants.sku")}`, {

Explanation: This modification appends &resources[options][fields]=title,product_type,variants.title,vendor,variants.sku to the search query. This tells the predictive search API to expand its search to include product titles, product types, variant titles, vendors, AND variant SKUs.

Important Considerations:

  • Test in a Duplicate Theme: Always, always, always make these changes in a duplicate copy of your theme first. This prevents any live site issues.
  • Theme Updates: Be aware that future theme updates might overwrite your customizations. Document your changes and be prepared to reapply them.
  • Developer Expertise: If you're not comfortable with JavaScript or theme file editing, it's highly recommended to consult a Shopify developer. Incorrect modifications can break your site's functionality.

Beyond SKUs: Holistic Search Optimization

While fixing SKU search is crucial, a truly effective storefront search experience goes further:

  • Rich Product Descriptions: Ensure your product descriptions are detailed and contain relevant keywords.
  • Meta Fields: Utilize Shopify's meta fields to store additional searchable data that doesn't fit into standard fields.
  • Third-Party Search Apps: For advanced needs, consider powerful search apps from the Shopify App Store (e.g., Search & Filter, Product Search & Discovery). These often offer more granular control over indexing, synonym management, and result ranking.
  • Clear Product Titles: Craft descriptive and concise product titles that customers are likely to search for.

Conclusion

A robust and accurate search function is non-negotiable for a positive customer experience and healthy conversion rates on your Shopify store. Whether you opt for the quick fix of product tagging or dive into theme customization, addressing search issues for SKUs and partial terms is a worthwhile investment. If you're struggling with complex Shopify development, theme customizations, or even considering a migration to Shopify, the Shopping Cart Mover team is here to provide expert guidance and seamless solutions.

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases