Order notes
ATUM extends the official WC's order notes endpoint (/wp-json/wc/v3/orders/<order_id>/notes) with extra info about the notes added by ATUM and its add-ons (stock changes, inventories used, etc.), so apps can parse and translate them instead of reading the note text.
This page only describes the ATUM additions. For the rest of the fields and the available operations (create, retrieve, list and delete order notes), see the WC REST API Docs.
The ATUM fields are included in the responses of all the order notes operations, and they're also added to the purchase order notes and inventory log notes endpoints.
Order note properties
| Attribute | Type | Description |
|---|---|---|
action | string | Action described in the note. Empty when the note has no ATUM data (for example, the notes added by WooCommerce or by hand). See the available actions. Only included when context is view. read-only ATUM |
params | array | List of parameters to parse the action. It usually contains one object with the action's data, such as the product, inventory and stock levels involved. Empty when the note has no ATUM data. Only included when context is view. read-only ATUM |
Order note actions
These are the values that the action field can take. Some of them only appear when the related add-on is active (e.g. the inventory actions need Multi-Inventory) or are only used in ATUM orders (purchase orders and inventory logs).
| Action | Description |
|---|---|
setStatus | The order status was set. |
changeStatus | The order status was changed. |
ajaxNote | Note added by a user from the order's edit page. |
apiNote | Note added through the ATUM REST API. |
increaseStock | The stock of the order items was increased. |
decreaseStock | The stock of the order items was decreased. |
increaseItemStock | The stock of an order item was increased. |
addedLineItems | Line items were added to the order. |
deletedLineItems | Line items were deleted from the order. |
deletedAdjustedLineItems | Line items with adjusted stock were deleted from the order. |
stockLevelsIncreased | Stock levels increased. |
stockLevelsProductIncreased | Stock levels of a product increased (e.g. after a refund). |
stockLevelsReduced | Stock levels reduced. |
stockLevelsChanged | Stock levels changed. |
unableRestore | The stock of an order item couldn't be restored. |
unableRestoreInventory | The stock of an order item's inventory couldn't be restored. |
unableReduce | The stock of an order item couldn't be reduced. |
unableReduceInventory | The stock of an order item's inventory couldn't be reduced. |
unableIncreaseStock | The stock of an order item couldn't be increased. |
unableDecreaseStock | The stock of an order item couldn't be decreased. |
unableIncreaseInventoryStock | The stock of an order item's inventory couldn't be increased. |
unableDecreaseInventoryStock | The stock of an order item's inventory couldn't be decreased. |
Retrieve an order note
This API lets you retrieve and view a specific note from an order, including the ATUM fields.
HTTP request
/wp-json/wc/v3/orders/<order_id>/notes/<id>curl https://example.com/wp-json/wc/v3/orders/727/notes/2286 \
-u consumer_key:consumer_secret{
"id": 2286,
"author": "system",
"date_created": "2019-03-22T16:28:08",
"date_created_gmt": "2019-03-22T19:28:08",
"note": "Stock levels reduced: Woo Single #1 (WOO-SINGLE-1)",
"customer_note": false,
"action": "stockLevelsReduced",
"params": [
{
"changes": [
{
"inventory_sku": "WOO-SINGLE-1",
"inventory_name": "Main Inventory",
"product_id": 93,
"item_name": "Woo Single #1 (WOO-SINGLE-1)",
"old_stock": 25,
"new_stock": 24
}
]
}
],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727/notes/2286"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727/notes"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727"
}
]
}
}List all order notes
This API helps you to view all the notes from an order, including the ATUM fields.
HTTP request
/wp-json/wc/v3/orders/<order_id>/notescurl https://example.com/wp-json/wc/v3/orders/727/notes \
-u consumer_key:consumer_secret[
{
"id": 2287,
"author": "system",
"date_created": "2019-03-22T16:28:08",
"date_created_gmt": "2019-03-22T19:28:08",
"note": "Order status changed from Pending payment to Processing.",
"customer_note": false,
"action": "",
"params": [],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727/notes/2287"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727/notes"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727"
}
]
}
},
{
"id": 2286,
"author": "system",
"date_created": "2019-03-22T16:28:08",
"date_created_gmt": "2019-03-22T19:28:08",
"note": "Stock levels reduced: Woo Single #1 (WOO-SINGLE-1)",
"customer_note": false,
"action": "stockLevelsReduced",
"params": [
{
"changes": [
{
"inventory_sku": "WOO-SINGLE-1",
"inventory_name": "Main Inventory",
"product_id": 93,
"item_name": "Woo Single #1 (WOO-SINGLE-1)",
"old_stock": 25,
"new_stock": 24
}
]
}
],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727/notes/2286"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727/notes"
}
],
"up": [
{
"href": "https://example.com/wp-json/wc/v3/orders/727"
}
]
}
}
]Available parameters
| Parameter | Type | Description |
|---|---|---|
context | string | Scope under which the request is made; determines fields present in response. Options: view and edit. Default is view. The ATUM fields are only included in the view context. |
type | string | Limit result to customers or internal notes. Options: any, customer and internal. Default is any. |