How can I search and display SKU in Dawn theme 2.0?

Topic summary

The discussion focuses on enabling SKU search functionality and display in Shopify’s Dawn theme 2.0.

Current Achievement:
One user successfully added SKU display in predictive search results by modifying predictive-search.liquid with code to show the current variant’s SKU.

Remaining Challenges:

  1. Making products searchable by SKU number
  2. Displaying SKU on the main search results page after pressing enter

Proposed Solutions:

  • Modify assets/predictive-search.js by adding variants.sku to the fetch request’s search fields parameter
  • Use search parameters like ?q=variants.sku%1234abcd

Important Limitations:
Shopify’s native search is basic and not designed for advanced SKU-based searching. Full implementation may require:

  • Dedicated third-party search apps
  • Extensive custom coding to create SKU lookup functionality
  • Workarounds using collection filters

Open Question:
One user asks about enabling partial SKU searches (e.g., searching “5685” to find “99.5685.52”), which remains unanswered and would likely require additional customization beyond the basic solution provided.

Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

I’ve been able to add SKU as part of the display by adding this in the predictive-search.liquid for Dawn 2.0


 {%- assign current_variant = product.selected_or_first_available_variant -%}
                    SKU: {{ current_variant.sku }} 

There are two additional modifications I need,

  1. Ability to search by SKU

  2. After pressing enter on search, display SKU in the screen that appears from the ‘Search’.

Please be specific about what code modifications are needed and where to include them.

Try adding variants.sku as a search parameter to search form behaviors.

i.e. ?q=variants.sku%1234abcd

The native shopify search for the online sales channel is very basic and introductory.

It isn’t meant to meet increasingly specific demands. So it’s all workarounds.

That feature is a large advanced customization beyond the scope of the forums.

Keep requests small and specific such as displaying/hiding some property, or styling.

Broadly you either need to:

  • use an actual dedicated search app/service that facilitates searching by a specific property
  • heavily customize the search to fake being a sku lookup / parts lookup tool (research the forums) by only showing exact match results in liquid and or javascript
  • and or heavily customize the filter system to use skus for filtering a collection with all products; and the limitations that comes with.

If you need this customization explored and built then contact me by my email for services.
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

Good Luck.

Ability to search by SKU in Dawn V14.0 I had to edit assets/predictive-search.js

Look for the Fetch request and update as follows:

fetch(`${routes.predictive_search_url}?q=${encodeURIComponent(searchTerm)}&resources[type]=product&resources[options][unavailable_products]=hide&resources[options][fields]=title,variants.sku,product_type,variants.title§ion_id=predictive-search`,
     { signal: this.abortController.signal }
    )
      .then((response) => {
        if (!response.ok) {
          var error = new Error(response.status);
          this.close();
          throw error;
        }
1 Like

Hi, your code works, but I was wondering if it is possible to add something extra so that people can search a specific part of the SKU.
Let’s say the item number SKU is: 99.5685.52.
I would like customer to search for 5685. and not the whole number beginning with 99.***

You think this is possible? Thx in advance

Thank you!