Id like to be able to search by SKU on my storefront but it doesnt seem to work.
I stumbled upon this
but im not exactly sure how to implement it.
Could someone help?
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:
You'd do this:
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.