How to trigger fetch_stock endpoint to sync inventory?

Tourist
16 0 2

My app implements a custom fulfillment service (fetch_stock endpoint).

 

When a shop changes their inventory in my app, I want that change to be reflected immediately in their Shopify Admin > Products. 

 

Currently, it can take up to an hour for Shopify to call the fetch_stock endpoint.

 

Similarly, I'd like the shop to be able to use the shopify admin to change inventory, and have  that change be pushed back to fulfillment service. I'm not sure if listening on the inventory_levels.update webhook will work here, since my app is managing the inventory?

 

0 Likes
Shopify Staff
Shopify Staff
366 49 56

Hey @Event-Ticketing,

 

That's right, it happens once per hour. Have you tried updating the quantity directly using the inventory API?

0 Likes
Highlighted
Tourist
16 0 2

@scottydont Since my app is managing the inventory through the fetch_stock endpoint, it doesn't seem right to modify the inventory directly through the API?

 

Additionally, I'm having issues because shop's can edit their inventory directly in the Admin > Products, even though the product inventory_service is set to my app. I can listen to inventory_levels/update webhook and update the inventory accordingly, but that webhook also fires when an order is created, so I have no way to differentiate whether the inventory was updated through the admin (meaning I need to update it on my end too) or through an order (I take no action). 

 

Is there another way to do this? Ideally, there would be a `source` attribute or similar, the value being "admin", or "order", in the inventory_levels/update webhook payload.

 

 

0 Likes