---
title: "Update Quantity by SKU"
method: PUT
path: "/products/update_quantity"
tags: ["Products"]
---

# Update Quantity by SKU

`PUT /products/update_quantity`

Update all products or product variations quantity by input SKU<br>更新所有相同商品貨號的商品或商品規格庫存數量

## Request body

- object
  - `sku` string — Product or Product Variation sku<br>商品或商品規格的商品貨號
  - `quantity` integer — This value should be between -9999999 and 9999999.<br> 數值必須在 -9999999 和 9999999 之間。<br>
  - `replace` boolean — Whether replacing the original quantity<br>是否取代原本數量<br> - <br> true: replace the product's quantity with the number you provided<br>取代原本數量<br><br> false: increase/decrease the quantity with the number you provided<br>增加/減少數量"

## Response `200`

OK

- object
  - `id` Id — unresolved $ref
  - `sku` Sku — unresolved $ref
  - `quantity` Quantity — unresolved $ref
  - `updated_at` string — Last Updated Time<br>商品或商品最後更新時間
  - `product_id` string
  - `items` object[] — All updated items. <br> 所有成功更新數量的加購品
    - `id` Id — unresolved $ref
    - `sku` Sku — unresolved $ref
    - `quantity` Quantity — unresolved $ref
    - `updated_at` string — Last Updated Time<br>商品或商品最後更新時間
    - `product_id` string
  - `errors` object[] — All failed updated items. <br> 所有更新數量失敗的商品
    - `id` Id — unresolved $ref
    - `message` object
      - `errors` string
      - `code` string
      - `caused_by` unknown
    - `status` string — HTTP status code

## Other responses

- `400` — Bad Request
- `403` — Forbidden request
- `404` — Product not found error
- `422` — Unprocessable entity error
- `500` — Server error

---

[API](https://skmtc.dev/shoplineapp/apis/shopline-open-api.md) · [All operations](https://skmtc.dev/shoplineapp/apis/shopline-open-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/shoplineapp/shopline-open-api/revisions/1675ac12cde7/schema)
