inventory.updated
Fired when an inventory record is updated in the store.
Event Structure
{
"event_type": "inventory.updated",
"payload": { ... }
}
Payload
{
"id": "6753a1b2c3d4e5f6a7b8c9d0",
"product_id": "6753a1b2c3d4e5f6a7b8c9d1",
"product": {
"_id": "6753a1b2c3d4e5f6a7b8c9d1",
"title": "Classic Cotton T-Shirt",
"handle": "classic-cotton-t-shirt",
"pricing": {
"price": 4500,
"compareAtPrice": 6000
},
"images": [
{
"_id": "img_001",
"file": "tshirt-front.jpg",
"fileUrl": "https://cdn.example.com/images/tshirt-front.jpg"
}
]
},
"variant_id": "6753a1b2c3d4e5f6a7b8c9d2",
"variant": {
"_id": "6753a1b2c3d4e5f6a7b8c9d2",
"options": [
{
"_id": "val_001",
"label": "Black",
"type": "color",
"value": "Black",
"colorCode": "#000000"
}
],
"pricing": {
"price": 4500,
"compareAtPrice": 6000
},
"quantity": 50,
"images": [
{
"_id": "img_002",
"file": "tshirt-black.jpg",
"fileUrl": "https://cdn.example.com/images/tshirt-black.jpg"
}
]
},
"store_id": "store_abc123",
"warehouse": {
"_id": "wh_001",
"name": "Main Warehouse",
"location": "Riyadh"
},
"quantity": 85,
"status": "in_stock",
"lowStockThreshold": 10,
"expiryDate": null,
"createdAt": "2025-12-01T10:30:00.000Z",
"updatedAt": "2025-12-05T14:15:00.000Z"
}
Payload Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique inventory record ID |
product_id | string | Associated product ID |
product | object | Populated product data |
product._id | string | Product ID |
product.title | string | Product title |
product.handle | string | Product URL slug |
product.pricing | object | Product pricing info |
product.images | array | Product images |
variant_id | string | null | Associated variant ID |
variant | object | null | Populated variant data |
variant._id | string | Variant ID |
variant.options | array | Selected option values |
variant.pricing | object | Variant pricing |
variant.quantity | number | Variant quantity |
variant.images | array | Variant images |
store_id | string | Store ID |
warehouse | object | null | Warehouse info |
warehouse._id | string | Warehouse ID |
warehouse.name | string | Warehouse name |
warehouse.location | string | Warehouse location |
quantity | number | Inventory quantity |
status | string | Inventory status (e.g. in_stock, out_of_stock) |
lowStockThreshold | number | Low stock alert threshold |
expiryDate | string | null | Expiry date if applicable |
createdAt | string | ISO 8601 creation timestamp |
updatedAt | string | ISO 8601 last update timestamp |
Example Handler
app/routes/webhooks.inventory.tsx
import { authenticate } from "~/qumra.server";
export async function action({ request }: { request: Request }) {
const { payload, topic, storeId } =
await authenticate.admin(request);
if (topic === "inventory.updated") {
console.log(`Inventory updated: ${payload.id} - Qty: ${payload.quantity}`);
if (payload.quantity <= payload.lowStockThreshold) {
console.log(`Low stock alert for: ${payload.product.title}`);
// Send low stock notification, trigger reorder, etc.
}
}
return Response.json({ success: true });
}