Shopify: Is it possible to find a product by sku n

2019-04-10 11:18发布

The data that I'm getting only contains the SKU numbers. I am trying to figure out how I can link these SKU numbers to the product variants in Shopify without the actual product id number.

Example data:

<Inventory ItemNumber="100B3001-B-01">
    <ItemStatus Status="Avail" Quantity="0" />
  </Inventory>
  <Inventory ItemNumber="100B3001-B-02">
    <ItemStatus Status="Avail" Quantity="0" />
  </Inventory>
  <Inventory ItemNumber="100B3001-B-03">
    <ItemStatus Status="Avail" Quantity="-1" />
    <ItemStatus Status="Alloc" Quantity="1" />
  </Inventory>
  <Inventory ItemNumber="100B3001-B-04">
    <ItemStatus Status="Avail" Quantity="-1" />
    <ItemStatus Status="Alloc" Quantity="1" />
  </Inventory>

标签: shopify
4条回答
等我变得足够好
2楼-- · 2019-04-10 11:55

You can use

*.myshopify.com/search?view=json&q=sku:SKUID
查看更多
Anthone
3楼-- · 2019-04-10 12:01

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.

查看更多
爷、活的狠高调
4楼-- · 2019-04-10 12:09

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.

查看更多
男人必须洒脱
5楼-- · 2019-04-10 12:13

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.

查看更多
登录 后发表回答