Hi! So, I tried using this on my browser: https://mystore.myshopify.com/admin/products/search.json?query=barcode:SMPLEBARCODE
It works on my browser, but when I try using it on my code, it give me a Status Code 404 NOT FOUND
I know I can filter product variants using a barcode or sku but I don't wanna go through all the products then filtering their variants until I find what I'm looking for. Say, when I have 500 or more products, it'll take a long time before I find the product variant that I want.
Can anyone help me with this?
The Product API does not have a search endpoint. That's why you are receiving a 404.
To find a specific variant, you'll need to fetch every product and filter from there. Storing them on your end intially and fetching occasionally to keep the records up to date would be one way to make things speedier to grab what you need after the initial sync.
That being said, if you have 500 products, only two API calls would need to be made to receive all products. The response would include variant information, which you could do whatever you need to with. I'm not sure that would qualify as a long time.
Hello @supspotify spotify
Did you find any solution for variant filter in product api?
I have related issue same as you.