GET a product by the sku

2,977 views
Skip to first unread message

Brandon Wargo

unread,
Jun 30, 2011, 8:57:47 PM6/30/11
to shopi...@googlegroups.com
Is it possible to send a GET request to find a shopify product by the product SKU?


~ Brandon

R. S.

unread,
Jul 1, 2011, 12:33:28 AM7/1/11
to shopify-api
This is exactly what I want too... I asked this question and got no
response - other than retrieving all the items and paging through
them :(

Edward Ocampo-Gooding

unread,
Jul 1, 2011, 2:00:34 AM7/1/11
to shopi...@googlegroups.com
This sort of thing sounds like a reasonable request given how SKUs are typically used like IDs.

I'll run the idea of having a filter for SKUs by the API devs on Monday.

(Happy Canada Day in the meantime :)


Edward Ocampo-Gooding
Shopify Developer Advocate

R. S.

unread,
Jul 1, 2011, 9:49:52 AM7/1/11
to shopify-api
That would be totally awesome! BTW, here's the algorithm we use in
case people don't specify a SKU or there's a conflict (which I guess
is possible):

* We check to find the first instance where a single Variant exists
that has the SKU. If it does, this is the SKU we use
* If someone adds a shopify product that doesn't have a SKU in the
Variant field, we usually use the Variant ID instead. So, our SKU
column contains either the SKU itself or the Variant ID
* When we query for the SKU, if we get no match, we'll query again for
the Variant ID. If a duplicate SKU exists, we only take the first one
returned.

We kept it as simple as possible.

Happy Canada Day!

On Jul 1, 2:00 am, Edward Ocampo-Gooding <edw...@jadedpixel.com>
wrote:
> This sort of thing sounds like a reasonable request given how SKUs are typically used like IDs.
>
> I'll run the idea of having a filter for SKUs by the API devs on Monday.
>
> (Happy Canada Day in the meantime :)
>
> Edward Ocampo-Gooding
> Shopify Developer Advocate
>
>
>
>
>
>
>
> On Friday, July 1, 2011 at 12:33 AM, R. S. wrote:
> > This is exactly what I want too... I asked this question and got no
> > response - other than retrieving all the items and paging through
> > them :(
>

John Duff

unread,
Jun 30, 2011, 9:27:01 PM6/30/11
to shopi...@googlegroups.com
You can't find by sku, but you can look it up by the product handle. Would tha work for what you are doing?

Sent from my iPhone

Dave

unread,
Jul 2, 2011, 7:19:51 PM7/2/11
to shopify-api
@John,

Handle only works from the client. Weird eh... you have to use ID on
server and handle with the client... no consistency... sure there's a
reason... but we'll probably not figure it out... like why does the
JSON filter in Liquid provide nearly useless image names but if you
query by handle, you get the fully qualified CDN asset. Makes all my
code somewhat messy in places... I sometimes pass the ID:handle as a
strategy, knowing I can deal both server and client side that way.

On Jun 30, 9:27 pm, John Duff <duff.j...@gmail.com> wrote:
> You can't find by sku, but you can look it up by the product handle. Would tha work for what you are doing?
>
> Sent from my iPhone
>

John Duff

unread,
Jul 3, 2011, 10:58:50 AM7/3/11
to shopi...@googlegroups.com
Hey Dave,

Handle was recently added on the server side as well. You can now do
admin/products.json?handle=tshirt-1 and get back the product with that
handle. See the updated API docs http://api.shopify.com/product.html .
I guess there wasn't really a notice put out about this, sorry about
that.

I am actually on the API and Integrations team at Shopify so we're
going to be trying to improve some of this stuff for you guys. I'll
take a look at that json filter and see if we can't make it a bit
easier to use.

Feel free to post to this list any ideas or suggestions you might have
for the API, we are here listening :).

-John

R. S.

unread,
Jul 5, 2011, 10:12:37 AM7/5/11
to shopify-api
Hi John --

Is there any way you can add a SKU filter so we can retrieve products
by SKU? In our case, since we're dealing with multi-store integration
with both Shopify and non-Shopify stores, the only common "handle" we
have is the SKU - right now, we have to query all results and page
through them to find the SKU (prior to any caching we do on our side).
Being able to retrieve a single item by SKU would be very helpful and
lessen your server load.

John Duff

unread,
Jul 5, 2011, 10:18:14 AM7/5/11
to shopify-api
We've heard this request from a number of people so we are going to be
looking into it. I just need to pass it by a couple people internally
to see what they think.

I'll post an update to this thread once I know more.

-John

John Duff

unread,
Jul 5, 2011, 8:43:14 PM7/5/11
to shopify-api
We talked about this a bit today and couldn't come up with a use case
where just storing the product id with the SKU wouldn't solve the
issue. Is there some reason why you can't do this?

Using SKU to map products between different stores isn't really the
best idea anyways, since they are not unique. Multiple products and
product variants can have the same SKU which would make mapping them
very difficult. You would be much better off having a model that
linked the products on both sides with the unique identifier that each
shop uses for that product.

If we have missed a case where keeping track of the product id itself
wouldn't solve the issue please let me know, otherwise it is unlikely
that we will be adding this.

-John

R. S.

unread,
Jul 6, 2011, 9:11:45 PM7/6/11
to shopify-api
Here's the scenario that's causing us problems. Our app is often used
to sync inventory quantities across multiple stores. The only way we
know that a product is the same from one store to the next is that the
SKU is the same. The product IDs are totally different in the Shopify
system. So, we have to look up the quantities that are currently
available in each of the Shopify stores, looked up by SKU, so that we
can match them against the same items in other Shopify (or non-
Shopify) stores and adjust them accordingly. This is even more
necessary now that you've taken away the capability for us to do a
direct update of inventory quantity (rather than a relative
adjustment) :(

All this is making it harder for us. Sure, we can just request all the
items, page through them all until we find the matching SKU, and then
do the update, but that's a huge inefficiency. As an FYI, we both
Magento and Etsy allow us to a) directly look up a product by its SKU
and b) update the quantities by directly setting the value. Shopify
can't do either (or at least in the near future, it won't be able to
do that), which is a significant disadvantage for folks that use our
product. But hey, do what you need to do - just realize that we would
*really* appreciate a way to look up a product by SKU. Is it possible
for two items to have the same SKU? Yeah. So what? Is it possible for
an item not to have any SKU at all? Sure. Big deal. We can deal with
that on our end. It's much easier to deal with multiple results coming
back than having to constantly page through the results.

But whatever, do what y'all have to do.

John Duff

unread,
Jul 8, 2011, 9:22:05 AM7/8/11
to shopify-api
Sorry if I'm missing something, but can't the api requests be
prevented by just storing your own mapping of SKU to product id for
each of the stores? You would have to go through the products once,
but after that you could do everything with webhooks and never have to
loop through the api again. You could put these in something like
Redis and it would be lightning fast, or a mySQL database wouldn't be
too bad either.

- John

R. S.

unread,
Jul 9, 2011, 8:45:48 AM7/9/11
to shopify-api
Sure I could. But then again, so can you. The difference is that I'd
be doing it just for myself, and you'd be doing it for all your
customers. This is *your* product. Sure, I can build out all the
things that your product is missing, but then the only person to
benefit from that would be me. I'm suggesting something that would
benefit all your customers. As mentioned, most of your competitors
offer a simple way to query a product based on SKU and also to update
that product's quantity just by setting it. Shopify does neither.
We're happy to fill these gaps in the Shopify product, but you should
realize that this is a competitive disadvantage.

If it's easy to implement, I'm not sure why you're pushing back on
this one feature so hard. But perhaps things are more complicated on
the Shopify side than I am aware of. Anyways, I'll just chalk this up
as another thing that Shopify can't / won't do. We'll just program for
it accordingly on our side and handle all the things that Shopify
won't do in our own product, even though Magento and other products
handle this natively in theirs.

jcnnghm

unread,
Jul 11, 2011, 5:54:29 PM7/11/11
to shopify-api
I need this functionality as well. SKUs are already used in of our
legacy databases, shopify ids are not.

Justin

jcnnghm

unread,
Jul 11, 2011, 6:00:49 PM7/11/11
to shopify-api
I need this functionality as well. Shopify id's aren't in our legacy
systems, SKU's are.

Justin

Arnas

unread,
Oct 21, 2011, 7:37:51 AM10/21/11
to shopi...@googlegroups.com
Hello,

what's the status for product filter by SKU, are you dismissing it completely or is it still on the table? 

I'm looking to integrate inventory synchronization between Shopify, eBay store and QuickBooks POS. Both QuickBooks and eBay APIs have this functionality. I especially like eBay's implementation (http://developer.ebay.com/DevZone/xml/docs/Reference/ebay/GetSellerList.html), it allows you to pass array of SKUs and returns relevant items.

Sincerely,
Arnold

John Duff

unread,
Oct 21, 2011, 8:41:31 AM10/21/11
to shopi...@googlegroups.com
It's still on the table, but there is no timeframe for when it will be available.

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages