Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

shopify

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>
like image 283
user1512535 Avatar asked Jan 14 '13 21:01

user1512535


1 Answers

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.

like image 74
Nicholas Piasecki Avatar answered Nov 09 '22 17:11

Nicholas Piasecki