Currently I can create products on a store using the Shopify GraphQL API.
My doubt is regarding the inventory updates.
The brick and mortar (b&m) store runs a software that has POS, inventory management, etc.
I can pull almost all the data out of this software via their API.
Currently, I would like to populate Shopify store with all the products we have.
I can create a python script that will upload all products.
My issue then becomes regarding inventory updates.
If the product creation script runs today, lets say I create 1,000 products in Shopify.
How do I then update the inventory levels tomorrow, for these 1,000 products?
I thought to use a mutation.
If I do use a mutation, how would I go about the logic of "update inventory if it is changed since yesterday' s update"?
Or do i re-send all 1,000 products to Shopify? Seems inefficient on my part to do it this way.
There's a few ways you can go about this, depending on the setup of your warehouse.
One option is to make inventory changes on the fly. If you're able to subscribe to a webhook or execute an API call from your warehouse app, you can update inventory in Shopify as soon as there's a change in the warehouse. This can be done with the inventory API as described here.
Another option as you mentioned is to update inventory as a recurring job. If you want to update inventory in batches every X number of hours, you don't have to send all 1000 products again. You should already know which products changed on your end, so you can send calls to update just those products. This can be done one-by-one using the REST API, or if you use GraphQL you can update inventory levels in bulk.
Depending on your fulfillment flow, you can also consider implementing a FulfillmentService. This allows you to connect products in the Shopify store to a warehouse that will manage inventory and fulfillment. If you enable inventory tracking for the fulfillmentService, Shopify will automatically keep inventory in sync by polling the warehouse once an hour for updated inventory levels. You would have to setup your warehouse to respond to these fetch_stock calls with the appropriate inventory levels, but once that's setup the process will be completely automated.
Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...By Gabe Jan 6, 2023
How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...By Skye Dec 30, 2022