POST

Bulk Decrement Inventory Items By Variant And Location


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Decrements quantities of multiple inventory items by variant and location.

Notes::

  • trackQuantity must be true to allow for decrementing the quantity.
  • If you pass restrictInventory: true and the decrementData.decrementBy amount is greater than the current quantity in stock, the request will fail with an INSUFFICIENT_INVENTORY error.
  • Pass restrictInventory: false to allow for negative quantities.
  • If you pass preorderRequest: true and the item is available for preorder, the item's preorderCounter will increase and the item's quantity will stay the same.
Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Stores - all permissions
Manage Products
Manage Restaurants - all permissions
Manage v3 catalog
Inventory write in v3 catalog
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/stores/v3/bulk/inventory-items/decrement-by-variant-and-location

Body Params
decrementDataArray <DecrementDataByVariantAndLocation>RequiredminItems 1maxItems 300

Variant and location IDs, as well as decrement data.


restrictInventoryboolean

Whether to allow negative inventory following this decrement action.

Default: false (negative inventory is not allowed)


returnEntityboolean

Whether to return the full inventory item entities in the response.

Default: false


reasonstring

Reason for decrement inventory action.

Response Object
resultsArray <BulkInventoryItemResult>minItems 1maxItems 300

Inventory items updated by bulk action.


bulkActionMetadataBulkActionMetadata

Bulk action metadata.

Decrement quantity of multiple inventory items by variant ID and location ID

Decrement quantity of multiple inventory items.

Request
cURL
curl -X POST \ 'https://www.wixapis.com/stores/v3/bulk/inventory-items/decrement-by-variant-and-location' \ -H 'Content-type: application/json' \ -H 'Authorization: <AUTH>' \ -d '{ "decrementData": [ { "variantId": "4d9126f7-6fcb-423a-89df-bd5e61b83b01", "locationId": "b6e63540-242c-462a-ac6c-b1e449e0c194", "decrementBy": 1 }, { "variantId": "666795f6-15dd-4f99-806e-129dd834f1ac", "decrementBy": 3 }, { "variantId": "ccfda17f-b124-4044-af19-069da8a83c25", "preorderRequest": true, "locationId": "10300abc-8f76-49a0-bf89-d5219a1418fa", "decrementBy": 2 } ], "returnEntity": true, "restrictInventory": true, "reason": "ORDER" }'
Response
JSON
{ "results": [ { "itemMetadata": { "id": "9bacfc09-2da2-4041-ac87-86df152d3edb", "originalIndex": 0, "success": true }, "item": { "id": "9bacfc09-2da2-4041-ac87-86df152d3edb", "revision": "1", "createdDate": "2024-07-04T11:07:05.775Z", "updatedDate": "2024-07-04T12:03:18.518Z", "variantId": "4d9126f7-6fcb-423a-89df-bd5e61b83b01", "locationId": "b6e63540-242c-462a-ac6c-b1e449e0c194", "productId": "b84d8a3b-52e7-403c-99ff-18db6185418b", "quantity": 8, "trackQuantity": true, "availabilityStatus": "IN_STOCK", "preorderInfo": { "enabled": false }, "product": { "name": "Sports Socks", "directCategoryIds": ["9d98c2b8-7cd3-4a61-a46f-bba5847128b2"] } } }, { "itemMetadata": { "id": "1832a09f-2b01-4731-9bfd-681994f452f1", "originalIndex": 1, "success": true }, "item": { "id": "1832a09f-2b01-4731-9bfd-681994f452f1", "revision": "1", "createdDate": "2024-07-04T10:53:55.922Z", "updatedDate": "2024-07-04T12:03:18.519Z", "variantId": "666795f6-15dd-4f99-806e-129dd834f1ac", "locationId": "b6e63540-242c-462a-ac6c-b1e449e0c194", "productId": "b84d8a3b-52e7-403c-99ff-18db6185418b", "quantity": 7, "trackQuantity": true, "availabilityStatus": "IN_STOCK", "preorderInfo": { "enabled": false }, "product": { "name": "Sports Socks", "directCategoryIds": ["9d98c2b8-7cd3-4a61-a46f-bba5847128b2"] } } }, { "itemMetadata": { "id": "169faacb-b979-405a-92d4-adb721c7f3a1", "originalIndex": 2, "success": true }, "item": { "id": "169faacb-b979-405a-92d4-adb721c7f3a1", "revision": "1", "createdDate": "2024-07-04T12:00:18.270Z", "updatedDate": "2024-07-04T12:03:18.519Z", "variantId": "ccfda17f-b124-4044-af19-069da8a83c25", "locationId": "10300abc-8f76-49a0-bf89-d5219a1418fa", "productId": "5d97b0ab-9b0c-4b1b-b89c-a43bba702321", "quantity": 0, "trackQuantity": true, "availabilityStatus": "PREORDER", "preorderInfo": { "enabled": true, "counter": 2 }, "product": { "name": "Running Shoes", "directCategoryIds": ["9d98c2b8-7cd3-4a61-a46f-bba5847128b2"] } } } ], "bulkActionMetadata": { "totalSuccesses": 3, "totalFailures": 0, "undetailedFailures": 0 } }
Errors
428Failed Precondition

There are 4 errors with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Did this help?