Hello Everybody,
Id like to be able to search by SKU on my storefront but it doesnt seem to work.
I stumbled upon this
https://freakdesign.com.au/blogs/news/search-for-a-shopify-product-by-sku
but im not exactly sure how to implement it.
Could someone help?
Hi Richard,
First, let me say awesome store! Brought back ancient memories of my PE teacher teaching us square dance, do-so-do-ing and the lot.
Could you let us know what theme you are using? It would make it easier to help you out how to integrate @Jason's code from the article. Unless it's a commercial theme - that's difficult for forum members support.
Either way, let us know and once again, great store!
That post is old, and needs to be updated to match the newer search format. I'll do that shortly.
The only change is how your refine the search to sku. Instead of something like this:
https://jasons-experiments.myshopify.com/search?type=product&q=sku:23200&view=sku
You'd do this:
https://jasons-experiments.myshopify.com/search?type=product&q=variants.sku:23200&view=sku
Note that sku has become variants.sku
@Jason I also need help with this issue on my site. We have lots of products we'll be uploaded, all with multiple variants. When a user needs to search by SKU, currently the site just returns the main product, not the variant SKU searched. This is bad UX as the user would have to click through each variant to find the SKU they want. Is there a solution to this
Your code handled the search so if you need to return the variant itself and not the product just loop over the variants to find the match. Once found, return that. Or return all and let some JS in the page do the picking of the correct variant.
Subject | Author | Posted |
---|---|---|
16m ago | ||
28m ago | ||
an hour ago | ||
2 hours ago | ||
2 hours ago |