I’ve emailed a more detailed bug report with reproduction steps to @JS_Goupil , but for documenting it here, we have a merchant who has a product with SKU 2001. However, when using api.productSearch.searchProduct with queryString 2001, it’s returning products that have a match to 200 as well. It seems there is some unexpected behavior when searching by number-based SKUs.
Good catch — and you’re right to flag this, because it’s a known quirk in how Shopify’s api.productSearch.searchProduct
(and similar APIs) handle numeric string queries.
Why this happens:
Shopify’s product search typically uses fuzzy or partial matching for queries — especially when dealing with numbers. So when you query 2001
, it also matches products with 200
because:
- The query might be tokenized or evaluated with partial relevance.
- Shopify doesn’t strictly enforce exact SKU matching in a general search context — it treats numeric SKUs more like text snippets.
How to handle this:
If you need a precise SKU search:
- Use a filter or exact match condition where available (if the API endpoint supports it — like in Admin API’s
products.json?fields=id,variants&handle&sku=2001
) - Or fetch products first and manually filter client-side.
For example:
const results = await api.productSearch.searchProduct({ queryString: '2001' });
const exactMatch = results.products.filter(product =>
product.variants.some(variant => variant.sku === '2001')
);
What to report (and you did well here)
This kind of numeric fuzzy matching isn’t always expected — so documenting this behavior is helpful for the dev team. If this isn’t intended, Shopify might eventually adjust it or clarify it in the API docs.