Inventory and Location Webhooks
Buy Online, Pick up in Store allows merchants to distribute inventory among locations. Developers might need notification when inventories or locations change. This notification helps them perform downstream actions required to manage inventory at multiple locations.
To this end, developers can subscribe to webhook events for changes to inventory or location.
This page is a reference for inventory and location webhooks for Buy Online, Pick up in Store. This article assumes that you’re familiar with webhooks.
For a general introduction to webhooks, see Webhooks Overview.
Storefront channels share the inventory for a product or variant. A product or variant’s inventory settings apply to all storefront channels. The * in the scope indicates that you subscribe to inventory events across all storefront channels. An inventory change fires a single webhook event.
You can track inventory changes at any location. A product or variant’s inventory levels and settings apply to a specific location. When you update inventory, the callback returns the location for the inventory.
Creating a webhook
To create a webhook, send a request to the Create a webhook endpoint. Follow the process described in the Webhooks Overview.
The following example creates a webhook that subscribes to changes in inventory settings.
- The
destinationURL must be served on port 443; custom ports are not currently supported. - It can take up to one minute for a newly created webhook to work.
For information on creating a webhook, consult the creating a webhook section of the Webhooks Overview.
Callback structure
For webhook callback structure reference, see Webhook Events.
Inventory
The following inventory webhook events fire in response to changes in inventory for a product or variant.
You can track inventory changes for products or variants. The * in the scope indicates that you subscribe to inventory events across all storefront channels. An inventory change fires a single webhook event.
Storefront channels share the inventory for a product or variant. For order-related events, the webhook fires a single event in response to a change from any storefront channel. For example, placing an order from any channel can trigger one webhook event.
A store’s inventory settings affect when stock levels change through an order. For example, stock levels can change when you either place or complete/ship an order. Stock levels can also change when you refund or cancel an order. Global settings apply when inventory changes through a manual order. Settings for a channel apply when inventory changes through an order in a channel.
Inventory payload objects take the form that follows:
The channel does not have to be active or visible for you to track changes.
Locations
The following location webhook events fire in response to actions that affect a location. You can track changes for any location.
Location payload objects take the form that follows: