We need to search and find the product based on SKU. I can see Predictive Search API is able to do that.
e.g. “/search/suggest.json?q=1090267&resources[type]=product&resources[options][unavailable_products]=hide&resources[options][fields]=variants.sku”
Wondering if we can use it for that purpose (given it’s designed for predictive search)?
Does it run the search on all products and guaranteed to find the product if SKU is unique and matches?
Is there any limitation with it (apart from max 10 records in the result which is fine)?
Is there any other option/API (non-Admin API) for searching products by SKU?
You can use the Storefront API directly to access product variants by SKU. SKU is related to products at the product variant level - so you could fetch the variant(s) with the associated product for each. For example:
{
productVariants(query: "sku:EXAMPLESKU", first: 10) {
edges{
node{
id
title
product {
id
title
}
}
}
}
}
I believe you are referring to Admin API, we have to create a private app for that which we can’t do atm due to time/resource constraints. That’s why I mentioned if there is any none-Admin API option. I am not sure about the limitations of the Predictive Search which does the search by SKU.
This is Stacy from the Searchanise Team, the app that offers professional search and filtering capabilities for Shopify stores.
If you’re looking for a way to search for products by SKU on your Shopify store, I recommend checking out our app.
The Smart Search Bar and Filters app is specifically designed to enhance the search functionality on your store, making it easier for customers to find products based on various attributes, including SKU.
Check out the app listing to learn about other useful features.