Adds to or subtracts from the inventory count of one or more products.
Adds to or subtracts from the inventory count of one or more products in a single request. Each adjustment changes the current count by the amount you send. To set the count to an exact value, use Product_Update.
Note
This function does not replace the total inventory count value. Instead, it adds or subtracts from the inventory count by the value sent. If you need to update the total inventory count, use the Product_Update function.
Before you begin#
- The API token needs
ProductList_Adjust_Inventory, either assigned directly under Functions or through a group. See Create an API token. - Requests must be signed if the token requires it. See Make a signed request with HMAC.
- You need each product’s ID, code or SKU.
Example requests#
Adjust inventory for several products#
Subtracts 10 from product 1, adds 9 to the product with code shirt, and leaves the product with SKU shirt-red-blue unchanged.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "ProductList_Adjust_Inventory",
"Inventory_Adjustments": [
{
"product_id": 1,
"adjustment": -10
},
{
"product_code": "shirt",
"adjustment": 9
},
{
"product_sku": "shirt-red-blue",
"adjustment": 0
}
]
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
Inventory_Adjustments |
Array | Adjustments to make, one element per product. See below. |
Inventory_Adjustments elements#
| Parameter | Type | Description |
|---|---|---|
product_idproduct_codeproduct_sku |
Number String String |
ID of the product Product code Product SKU. One of these is required. |
adjustment |
Integer | Required. Amount (positive or negative) to adjust the total inventory count by. |
Example response#
{
"success": 1
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
success |
boolean | Boolean value for if the request was successful |
Related functions#
| Function | Use it to |
|---|---|
Product_Update |
Set a product’s inventory count to an exact value |
ProductList_Load_Query |
Check inventory with the product_inventory on-demand column |
ProductVariantList_Load_Product |
Find the variant parts that hold inventory |
Product_Insert |
Create a product with a starting inventory count |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Products > ProductList_Adjust_Inventory. See Set Up Postman.