1

I want to change quantity number on specific product after payment receive. And after that I reveave 400 error.

Is it possible to change the stock quantity? Or Am I doing something wrong? I try to do API CALL with url and body

/rest//V1/products/

{
    "product": {
        "sku": "<skuNumber>",
        "extension_attributes": {
            "stock_item": {
                "qty": 4
            }
        }
    }
}
1

Try this endpoint POST /rest/default/V1/inventory/source-items with a payload like this:

[
 {
  "sourceItems": [
    {
      "sku": "WSH12-29-Red",
      "source_code": "default",
      "quantity": 111,
      "status": 1
    },
     {
      "sku": "MH01-XS-Black",
      "source_code": "default",
      "quantity": 222,
      "status": 1
    }
   ]
  }
]

Note that in my case, the source_code is my default source from Magento MSI. You will have to replace it with the name of your source if you have custom sources.

Reference: https://magento.redoc.ly/2.4.2-admin/tag/inventorysource-items/#operation/inventoryApiSourceItemsSaveV1ExecutePost

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.