Inventories
The ATUM inventories API allows you to create, view, update, and delete inventories.
Inventory properties
| Attribute | Type | Description |
|---|---|---|
id | integer | Unique identifier for the inventory. read-only |
product_id | integer | The product ID this inventory is linked to. read-only |
name | string | The inventory name. It must be unique within the product's inventories. mandatory |
priority | integer | The priority index within the list of the product inventories' list. |
is_main | boolean | Whether the current inventory is the main inventory. Only one Main Inventory is allowed per product. |
inventory_date | date-time | The date the inventory was created, as GMT. |
lot | string | The LOT/BATCH number. |
write_off | boolean | Whether the current inventory was marked as 'write-off'. |
region | array | If the region restriction mode is enabled, it'll show the list of countries or shipping zones linked to the inventory. In countries mode, it's a list of country codes (__atum_rest_of_world__ stands for all the other countries). In shipping zones mode, it's returned as an object with the zone names keyed by zone ID, and it accepts zone names or IDs when writing (0 stands for the rest of the world). |
location | array | ATUM Location(s) linked to the inventory. It's returned as an object with the location slugs keyed by term ID, and it accepts location term IDs or slugs when writing. |
bbe_date | date-time | The Best-Before-Expiry date for the inventory, as GMT. |
expiry_threshold | integer | The expiry threshold (in days) before the BBE date when the product should go out of stock. When it's 0, the default expiry threshold from the Multi-Inventory settings is used. It's reset to 0 if the inventory has no BBE date. |
inbound_stock | number | Inventory's inbound stock. read-only |
stock_on_hold | number | Inventory's stock on hold. read-only |
sold_today | number | Inventory units sold today. read-only |
sales_last_days | number | Inventory sales the last 14 days. read-only |
reserved_stock | number | Inventory stock set as 'reserved stock' within Inventory Logs. read-only |
customer_returns | number | Inventory stock set as 'customer returns' within Inventory Logs. read-only |
warehouse_damage | number | Stock set as 'warehouse damage' within Inventory Logs. read-only |
lost_in_post | number | Stock set as 'lost in post' within Inventory Logs. read-only |
other_logs | number | Stock set as 'other' within Inventory Logs. read-only |
out_stock_days | integer | The number of days that the product is Out of stock. read-only |
lost_sales | number | Product lost sales. read-only |
update_date | date-time | Last date when the inventory data was calculated and saved for this product, as GMT. |
meta_data | object | Meta data. See Inventories - Meta data properties |
The calculated properties (from inbound_stock to update_date) are only returned in the view context. The create, update, delete and batch responses use the edit context, so they don't include them.
Inventories - Meta data properties
| Attribute | Type | Description |
|---|---|---|
sku | string | Inventory's SKU. |
manage_stock | boolean | Whether the stock is being managed for the inventory. |
stock_quantity | number | Inventory's stock amount. |
backorders | string | Whether the backorders are allowed. Options: no, notify and yes. |
stock_status | string | Inventory's stock status. Options: instock, outofstock and onbackorder. |
supplier_id | integer | Inventory supplier's ID. |
supplier_sku | string | Inventory supplier's SKU. |
barcode | string | Inventory barcode. |
sold_individually | boolean | Whether the inventory should be sold individually. |
out_stock_threshold | number | Inventory's out of stock threshold. |
low_stock_threshold | number | Inventory's low stock threshold. |
purchase_price | number | Inventory's purchase price. |
price | number | Inventory's price. |
regular_price | number | Inventory's regular price. |
sale_price | number | Inventory's sale price. |
date_on_sale_from | date-time | The date when starts the sale price, as GMT. |
date_on_sale_to | date-time | The date when ends the sale price, as GMT. |
out_stock_date | date-time | The date when the inventory run out of stock, as GMT. |
expired_stock | number | The expired stock amount. |
is_expired | boolean | Whether the inventory has expired. |
Create an inventory
This API helps you to create a new inventory for the specified product.
HTTP request
/wp-json/wc/v3/products/<product_id>/inventoriesExample of how to create a product inventory
curl -X POST https://example.com/wp-json/wc/v3/products/507/inventories \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"name": "Inventory 1",
"is_main": false,
"meta_data": {
"sku": "TEST1",
"manage_stock": true,
"stock_quantity": 10,
"backorders": "no",
"stock_status": "instock",
"purchase_price": 9.5,
"price": 12,
"regular_price": 12
}
}'{
"id": 208,
"product_id": 507,
"name": "Inventory 1",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T09:16:19",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "TEST1",
"manage_stock": true,
"stock_quantity": 10,
"backorders": "no",
"stock_status": "instock",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "9.5",
"price": "12",
"regular_price": "12",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}Retrieve an inventory
This API lets you retrieve an inventory by ID. The inventory must belong to the product specified in the URL.
HTTP request
/wp-json/wc/v3/products/<product_id>/inventories/<id>curl https://example.com/wp-json/wc/v3/products/507/inventories/208 \
-u consumer_key:consumer_secret{
"id": 208,
"product_id": 507,
"name": "Inventory 1",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T09:16:19",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"inbound_stock": "0",
"stock_on_hold": 0,
"sold_today": 0,
"sales_last_days": 0,
"reserved_stock": 0,
"customer_returns": 0,
"warehouse_damage": 0,
"lost_in_post": 0,
"other_logs": 0,
"out_stock_days": 0,
"lost_sales": 0,
"update_date": "2020-09-01T09:16:19",
"meta_data": {
"sku": "TEST1",
"manage_stock": true,
"stock_quantity": 10,
"backorders": "no",
"stock_status": "instock",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "9.5",
"price": "12",
"regular_price": "12",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}List all the product inventories
This API lets you retrieve all the inventories for the specified product.
This endpoint isn't paginated: it returns all the product inventories that match the filters, sorted by priority by default.
HTTP request
/wp-json/wc/v3/products/<product_id>/inventoriescurl https://example.com/wp-json/wc/v3/products/507/inventories \
-u consumer_key:consumer_secret[
{
"id": "55",
"product_id": 507,
"name": "Main Inventory",
"priority": 0,
"is_main": true,
"inventory_date": "2019-09-11T10:26:00",
"lot": "",
"write_off": false,
"region": [],
"location": {
"50": "madrid"
},
"bbe_date": null,
"expiry_threshold": 0,
"inbound_stock": "1",
"stock_on_hold": 4,
"sold_today": 0,
"sales_last_days": 0,
"reserved_stock": 1,
"customer_returns": 0,
"warehouse_damage": 0,
"lost_in_post": 0,
"other_logs": 0,
"out_stock_days": 0,
"lost_sales": 0,
"update_date": "2020-08-31T07:27:30",
"meta_data": {
"sku": "",
"manage_stock": true,
"stock_quantity": 22,
"backorders": "no",
"stock_status": "instock",
"supplier_id": 399,
"supplier_sku": "CRYPTO",
"barcode": "INVBARKJHOIHO",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "2",
"price": "5.32",
"regular_price": "5.32",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/55"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
},
{
"id": "208",
"product_id": 507,
"name": "Inventory 1",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T09:16:19",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"inbound_stock": "0",
"stock_on_hold": 0,
"sold_today": 0,
"sales_last_days": 0,
"reserved_stock": 0,
"customer_returns": 0,
"warehouse_damage": 0,
"lost_in_post": 0,
"other_logs": 0,
"out_stock_days": 0,
"lost_sales": 0,
"update_date": "2020-09-01T09:16:19",
"meta_data": {
"sku": "TEST1",
"manage_stock": true,
"stock_quantity": 10,
"backorders": "no",
"stock_status": "instock",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "9.5",
"price": "12",
"regular_price": "12",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}
]Available parameters
| Parameter | Type | Description |
|---|---|---|
context | string | Scope under which the request is made; determines fields present in response. Options: view and edit. |
after | string | Limit response to resources created after a given ISO8601 compliant date. |
before | string | Limit response to resources created before a given ISO8601 compliant date. |
exclude | array | Ensure result set excludes specific IDs. |
include | array | Limit result set to specific IDs. |
offset | integer | Offset the result set by a specific number of items. |
order | string | Order sort attribute ascending or descending. Options: asc and desc. Default is asc. |
orderby | string | Sort collection by object attribute. Options: priority, inventory_date, id, name and bbe_date. Default is priority. |
name | string | Limit result set to inventories with a specific name. |
exclude_write_off | boolean | Exclude from result set the inventories that were marked as 'write off'. Default is true. |
lot | string | Limit result set to inventories with the specified LOT/BATCH number. |
barcode | string | Limit result set to inventories with the specified barcode. |
country | string | If the country restriction mode is enabled, limit the result set to inventories linked to the specified country code. |
shipping_zone | string | If the shipping zone restriction mode is enabled, limit the result set to inventories linked to the specified shipping zone name. |
location | string | Limit the result set to inventories linked to the specified location. It accepts a location term ID or a location name. |
The country and shipping_zone parameters are only available when the matching region restriction mode is enabled in the Multi-Inventory settings.
List all the inventories
This API lets you retrieve all the inventories registered on the system, from all the products. The results are paginated.
HTTP request
/wp-json/wc/v3/atum/inventoriescurl https://example.com/wp-json/wc/v3/atum/inventories \
-u consumer_key:consumer_secret[
{
"id": "3",
"product_id": 90,
"name": "Custom Inventory",
"priority": 5,
"is_main": false,
"inventory_date": "2018-10-25T10:10:00",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"inbound_stock": "0",
"stock_on_hold": 17,
"sold_today": 0,
"sales_last_days": 0,
"reserved_stock": 0,
"customer_returns": 0,
"warehouse_damage": 0,
"lost_in_post": 0,
"other_logs": 0,
"out_stock_days": 0,
"lost_sales": 0,
"update_date": "2020-10-05T07:20:52",
"meta_data": {
"sku": "WOO3",
"manage_stock": true,
"stock_quantity": 3,
"backorders": "no",
"stock_status": "instock",
"supplier_id": 399,
"supplier_sku": "SUPSK1",
"barcode": "AAAAAABBBBBB",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "18.9",
"price": "15.7",
"regular_price": "15.7",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v3/products/90/inventories/3"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v3/products/90/inventories"
}
],
"up": [
{
"href": "http://example.com/wp-json/wc/v3/products/90"
}
]
}
},
{
"id": "7",
"product_id": 83,
"name": "Main Inventory",
"priority": 0,
"is_main": true,
"inventory_date": "2018-10-25T10:10:24",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"inbound_stock": "0",
"stock_on_hold": 0,
"sold_today": 0,
"sales_last_days": 0,
"reserved_stock": 0,
"customer_returns": 0,
"warehouse_damage": 0,
"lost_in_post": 0,
"other_logs": 0,
"out_stock_days": 108,
"lost_sales": 0,
"update_date": "2020-10-05T07:20:53",
"meta_data": {
"sku": "",
"manage_stock": true,
"stock_quantity": 0,
"backorders": "no",
"stock_status": "instock",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": 0,
"low_stock_threshold": "",
"purchase_price": "128",
"price": "9",
"regular_price": "9",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": "2020-06-18T09:08:57",
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v3/products/83/inventories/7"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v3/products/83/inventories"
}
],
"up": [
{
"href": "http://example.com/wp-json/wc/v3/products/83"
}
]
}
},
{
"id": "10",
"product_id": 37,
"name": "Main Inventory",
"priority": 0,
"is_main": true,
"inventory_date": "2018-06-06T10:14:00",
"lot": "123456",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"inbound_stock": "0",
"stock_on_hold": 0,
"sold_today": 0,
"sales_last_days": 0,
"reserved_stock": 0,
"customer_returns": 0,
"warehouse_damage": 1,
"lost_in_post": 0,
"other_logs": 0,
"out_stock_days": 0,
"lost_sales": 0,
"update_date": "2020-06-04T06:20:29",
"meta_data": {
"sku": "",
"manage_stock": true,
"stock_quantity": 2,
"backorders": "no",
"stock_status": "instock",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "5",
"price": "12",
"regular_price": "12",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "http://example.com/wp-json/wc/v3/products/37/inventories/10"
}
],
"collection": [
{
"href": "http://example.com/wp-json/wc/v3/products/37/inventories"
}
],
"up": [
{
"href": "http://example.com/wp-json/wc/v3/products/37"
}
]
}
}
]Available parameters
| Parameter | Type | Description |
|---|---|---|
context | string | Scope under which the request is made; determines fields present in response. Options: view and edit. |
page | integer | Current page of the collection. Default is 1. |
per_page | integer | Maximum number of items to be returned in result set. Default is 10. |
search | string | Limit results to inventories whose name contains the specified string. |
after | string | Limit response to resources created after a given ISO8601 compliant date. |
before | string | Limit response to resources created before a given ISO8601 compliant date. |
modified_after | string | Limit response to inventories whose data was updated after a given ISO8601 compliant date. |
modified_before | string | Limit response to inventories whose data was updated before a given ISO8601 compliant date. |
dates_are_gmt | boolean | Whether the dates passed to the date filters are in GMT. Default is false. |
exclude | array | Ensure result set excludes specific IDs. |
include | array | Limit result set to specific IDs. |
offset | integer | Offset the result set by a specific number of items. |
order | string | Order sort attribute ascending or descending. Options: asc and desc. Default is asc. |
orderby | string | Sort collection by object attribute. Options: priority, inventory_date, id, name and bbe_date. Default is id. |
name | string | Limit result set to inventories with a specific name. |
exclude_write_off | boolean | Exclude from result set the inventories that were marked as 'write off'. Default is true. |
lot | string | Limit result set to inventories with the specified LOT/BATCH number. |
barcode | string | Limit result set to inventories with the specified barcode. |
country | string | If the country restriction mode is enabled, limit the result set to inventories linked to the specified country code. countries is accepted as an alias. |
shipping_zone | string | If the shipping zone restriction mode is enabled, limit the result set to inventories linked to the specified shipping zone name. shipping_zones is accepted as an alias. |
location | string | Limit the result set to inventories linked to the specified location. It accepts a location term ID or a location name. |
product | integer | Limit result set to inventories of the specified product ID. |
Update an inventory
This API lets you make changes to a product inventory.
HTTP request
/wp-json/wc/v3/products/<product_id>/inventories/<id>curl -X PUT https://example.com/wp-json/wc/v3/products/507/inventories/208 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"meta_data": {
"stock_quantity": 200
}
}'{
"id": 208,
"product_id": 507,
"name": "Inventory 1",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T09:16:19",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "TEST1",
"manage_stock": true,
"stock_quantity": 200,
"backorders": "no",
"stock_status": "instock",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "9.5",
"price": "12",
"regular_price": "12",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}Delete a product inventory
This API helps you delete a product inventory. The Main Inventory of a product can't be deleted.
HTTP request
/wp-json/wc/v3/products/<product_id>/inventories/<id>curl -X DELETE https://example.com/wp-json/wc/v3/products/507/inventories/208?force=true \
-u consumer_key:consumer_secret{
"id": 208,
"product_id": 507,
"name": "Inventory 1",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T09:16:19",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "TEST1",
"manage_stock": true,
"stock_quantity": 200,
"backorders": "no",
"stock_status": "instock",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "9.5",
"price": "12",
"regular_price": "12",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/208"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}Available parameters
| Parameter | Type | Description |
|---|---|---|
force | boolean | Required to be true, as inventories do not support trashing. Default is false. |
Batch update product inventories
This API helps you to batch create, update and delete multiple product inventories.
Note: By default it's limited to up to 100 objects to be created, updated or deleted. The inventories listed in delete are always deleted permanently.
HTTP request
/wp-json/wc/v3/products/<product_id>/inventories/batchcurl -X POST https://example.com/wp-json/wc/v3/products/507/inventories/batch \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"create": [
{
"name": "TEST Batch Inventory",
"is_main": false
}
],
"update": [
{
"id": 152,
"meta_data": {
"manage_stock": true,
"stock_quantity": 20
}
}
],
"delete": [ 210, 211 ]
}'{
"create": [
{
"id": 212,
"product_id": 507,
"name": "TEST Batch Inventory",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T11:11:31",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"stock_status": "",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "",
"price": "",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/212"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}
],
"update": [
{
"id": 152,
"product_id": 507,
"name": "TEST Batch Inventory",
"priority": 1,
"is_main": false,
"inventory_date": "2019-06-11T10:08:00",
"lot": "",
"write_off": false,
"region": [],
"location": {
"53": "slovakia",
"49": "valencia"
},
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "",
"manage_stock": true,
"stock_quantity": 20,
"backorders": "no",
"stock_status": "instock",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "5",
"price": "20",
"regular_price": "20",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/152"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}
],
"delete": [
{
"id": 210,
"product_id": 507,
"name": "TEST Batch Inventory",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T11:10:02",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"stock_status": "",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "",
"price": "",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/210"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
},
{
"id": 211,
"product_id": 507,
"name": "TEST Batch Inventory",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T11:10:05",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"stock_status": "",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "",
"price": "",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/211"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}
]
}Batch update All inventories
This API helps you to batch create, update and delete multiple inventories at once and also mixing inventories from distinct products at the same time.
Note: By default it's limited to up to 100 objects to be created, updated or deleted. Each inventory in create must include the product_id it belongs to. The inventories listed in delete are always deleted permanently.
HTTP request
/wp-json/wc/v3/atum/inventories/batchcurl -X POST https://example.com/wp-json/wc/v3/atum/inventories/batch \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"create": [
{
"product_id": 2123,
"name": "TEST Batch Inventory",
"is_main": false
}
],
"update": [
{
"id": 152,
"meta_data": {
"manage_stock": true,
"stock_quantity": 20
}
}
],
"delete": [ 210, 211 ]
}'{
"create": [
{
"id": 212,
"product_id": 507,
"name": "TEST Batch Inventory",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T11:11:31",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"stock_status": "",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "",
"price": "",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/212"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}
],
"update": [
{
"id": 152,
"product_id": 507,
"name": "TEST Batch Inventory",
"priority": 1,
"is_main": false,
"inventory_date": "2019-06-11T10:08:00",
"lot": "",
"write_off": false,
"region": [],
"location": {
"53": "slovakia",
"49": "valencia"
},
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "",
"manage_stock": true,
"stock_quantity": 20,
"backorders": "no",
"stock_status": "instock",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "5",
"price": "20",
"regular_price": "20",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/152"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}
],
"delete": [
{
"id": 210,
"product_id": 507,
"name": "TEST Batch Inventory",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T11:10:02",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"stock_status": "",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "",
"price": "",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/210"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
},
{
"id": 211,
"product_id": 507,
"name": "TEST Batch Inventory",
"priority": 0,
"is_main": false,
"inventory_date": "2020-09-01T11:10:05",
"lot": "",
"write_off": false,
"region": [],
"location": [],
"bbe_date": null,
"expiry_threshold": 0,
"meta_data": {
"sku": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"stock_status": "",
"supplier_id": "",
"supplier_sku": "",
"barcode": "",
"sold_individually": false,
"out_stock_threshold": "",
"low_stock_threshold": "",
"purchase_price": "",
"price": "",
"regular_price": "",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_to": null,
"out_stock_date": null,
"expired_stock": null,
"is_expired": false
},
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories/211"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products/507/inventories"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/products/507"
}
]
}
}
]
}