For the complete documentation index, see llms.txt. This page is also available as Markdown.

Update product variants in batch

Update up to 100 existing variants in place by id — title, inventory, stock tracking and prices.

Update product variants in batch

patch

Update up to 100 existing variants in place by id — title, inventory, stock tracking and prices. Variants omitted from the request are left untouched. Prices replace the variant's existing prices in full. Returns the updated variants.

Authorizations
AuthorizationstringRequired

API Token authentication

Path parameters
store_idstringRequired

The ID of the store that owns the product.

Example: store_01J8Z5F8W9K8M4A7B3C2D1E0FG
product_idstringRequired

The ID of the product whose variants are being updated.

Example: prod_01J8Z5F8W9K8M4A7B3C2D1E0FG
Body
Responses
200

Success response

application/json
patch/api/ecommerce/v1/stores/{store_id}/products/{product_id}/variants/batch
PATCH /api/ecommerce/v1/stores/{store_id}/products/{product_id}/variants/batch HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 195

{
  "variants": [
    {
      "variant_id": "variant_01J8Z5F8W9K8M4A7B3C2D1E0FG",
      "title": "Red / L",
      "inventory_quantity": 42,
      "manage_inventory": true,
      "prices": [
        {
          "amount": 1999,
          "sale_amount": 1499,
          "currency": "usd"
        }
      ]
    }
  ]
}
{
  "data": [
    {
      "id": "variant_01J8Z5F8W9K8M4A7B3C2D1E0FG",
      "title": "Red / M",
      "sku": "TSHIRT-RED-M",
      "options": [
        {
          "name": "Size",
          "value": "M"
        }
      ],
      "prices": [
        {
          "amount": 1999,
          "sale_amount": null,
          "currency_code": "usd"
        }
      ],
      "inventory_quantity": 42,
      "manage_inventory": true
    }
  ]
}

Last updated

Was this helpful?