---
title: Stock Events
description: Documentation for stock-related webhook events
sidebar:
  label: Stock Events
---

This section covers all webhook events related to variant stocks and inventory.

## Event Types

The following stock-related events are available:

- `variant_stock.updated` - Triggered when variant stock quantity is updated
- `variant_stock.deleted` - Triggered when variant stock is removed
- `variant_stock_delta.updated` - Triggered when a stock quantity change (delta) occurs

## Variant Stock Updated Event

The `variant_stock.updated` event is triggered when a variant's stock quantity is updated.

### Event Structure

```json
{
  "event_type": "variant_stock.updated",
  "payload": {
    "inventory_id": "INV-123",
    "product_parent_id": "123e4567-e89b-12d3-a456-426614174000",
    "product_variant_id": "123e4567-e89b-12d3-a456-426614174001",
    "product_variant_number": "VAR-123",
    "quantity": 100,
    "inventory_date": "2024-02-12T12:00:00Z",
    "update_source": "manual",
    "available_online": true,
    "stock_updated": true
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `inventory_id` | string | Unique identifier for the inventory record |
| `product_parent_id` | string | ID of the parent product |
| `product_variant_id` | string | ID of the variant |
| `product_variant_number` | string | Variant number |
| `quantity` | number | Current stock quantity |
| `inventory_date` | string | Timestamp of the inventory update |
| `update_source` | string | Source of the update (manual, system, etc.) |
| `available_online` | boolean | Whether the stock is available for online purchase |
| `stock_updated` | boolean | Whether was updated in the request or not |

## Variant Stock Deleted Event

The `variant_stock.deleted` event is triggered when a variant's stock record is removed.

### Event Structure

```json
{
  "event_type": "variant_stock.deleted",
  "payload": {
    "inventory_id": "INV-123",
    "product_parent_id": "123e4567-e89b-12d3-a456-426614174000",
    "product_variant_id": "123e4567-e89b-12d3-a456-426614174001",
    "product_variant_number": "VAR-123"
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `inventory_id` | string | ID of the deleted inventory record |
| `product_parent_id` | string | ID of the parent product |
| `product_variant_id` | string | ID of the variant |
| `product_variant_number` | string | Variant number |

## Variant Stock Delta Updated Event

The `variant_stock_delta.updated` event is triggered when there's a change in stock quantity (increment or decrement).

### Event Structure

```json
{
  "event_type": "variant_stock_delta.updated",
  "payload": {
    "inventory_id": "INV-123",
    "product_variant_number": "VAR-123",
    "quantity": 5,
    "delta": -20,
    "available_online": true
  }
}
```

### Field Descriptions

| Field | Type | Description |
|-------|------|-------------|
| `inventory_id` | string | ID of the inventory record |
| `product_variant_number` | string | Variant number |
| `quantity` | number | New total stock |
| `delta` | number | Change in quantity (positive for increase, negative for decrease) |
| `available_online` | boolean | Whether the stock is available for online purchase |
