Shopify: Is it possible to find a product by sku number?

时光毁灭记忆、已成空白 提交于 2019-12-04 10:03:51

Here's a delightful, condescending discussion from Shopify employees in 2011 asking why you can't just store the Shopify ID everywhere. The "stock-keeping unit" is a universal systems integration point and, in every system I've seen, each SKU uniquely maps to a product because words have meaning, but apparently not at Shopify.

Three years later, you seem to have two options.

One is to create a Fulfillment Service and provide a URL where Shopify will call you asking for stock levels on a SKU; this is probably the simplest solution, provided you have a Web server sitting somewhere where you can expose such a callback.

The second is to periodically page through all of the Products and store a mapping of the Shopify ID to a SKU somewhere, consulting your map when you need to do an update. Because most of our integrations are cron jobs and I'd like to keep them that way, I periodically ask for the products that have changed since the last run, and then update my mapping.

As David Lazar points out in his comment, the ability to find a product based on its SKU is not currently supported in the Shopify API.

EDIT: This is an unreliable option that I once used as a last resort. I wouldn't recommend using this but I will leave it here in case as someone may find it helpful.

You can use this API endpoint:

/admin/products/search.json?query=sku:abc123

I have only used it in the browser though, and I can't find any documentation for it. And it may stop working at any time.

You can use

*.myshopify.com/search?view=json&q=sku:SKUID
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!