> ## Documentation Index
> Fetch the complete documentation index at: https://dev.puppetvendors.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Product Inventory

> Inventory-only update without touching product/variant data

<Note>
  **V2 Preview** — This endpoint is part of the V2 API preview. Breaking changes may occur.
</Note>

## Overview

Inventory-only update designed for the vendor quick-view modal. Uses Shopify's `inventorySetQuantities` (absolute) or `inventoryAdjustQuantities` (delta) depending on `mode`. Does **not** touch product/variant metadata — only the on-hand count.

## Path Parameters

<ParamField path="productId" type="string" required>
  Product ID (Shopify numeric, GID, or MongoDB ObjectId).
</ParamField>

## Request Body

<ParamField body="mode" type="string" required>
  `set` (absolute) or `adjust` (delta).
</ParamField>

<ParamField body="updates" type="array" required>
  Array of `{ variantId, locationId, quantity }` (for `set`) or `{ variantId, locationId, delta }` (for `adjust`).
</ParamField>

## Response

```json 200 theme={null}
{
  "success": true,
  "data": {
    "updated": 2,
    "errors": []
  }
}
```

## Example

```bash theme={null}
curl -X PATCH "https://staging-api.puppetvendors.com/products/507f1f77bcf86cd799439013/inventory" \
  -H "x-access-token: YOUR_VENDOR_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "set",
    "updates": [
      { "variantId": "gid://shopify/ProductVariant/1", "locationId": "gid://shopify/Location/1", "quantity": 50 }
    ]
  }'
```

### More Examples

**Set inventory to exact quantity**

```bash theme={null}
curl -X PATCH "https://staging-api.puppetvendors.com/products/507f1f77bcf86cd799439013/inventory" \
  -H "x-access-token: YOUR_VENDOR_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "set",
    "variants": [
      {
        "variantId": "gid://shopify/ProductVariant/123",
        "locationId": "gid://shopify/Location/456",
        "quantity": 100
      }
    ]
  }'
```

**Adjust inventory (add 10 units)**

```bash theme={null}
curl -X PATCH "https://staging-api.puppetvendors.com/products/507f1f77bcf86cd799439013/inventory" \
  -H "x-access-token: YOUR_VENDOR_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "adjust",
    "variants": [
      {
        "variantId": "gid://shopify/ProductVariant/123",
        "locationId": "gid://shopify/Location/456",
        "quantity": 10
      }
    ],
    "reason": "Restock from supplier"
  }'
```
