Contents
On this page
Finalize Adjustment - Plugixa Inventory
POST /plugixa-inventory/v1/adjustments/{id}/finalize
Finalize a draft adjustment: its lines are written to the stock ledger and on hand changes.
The user needs the plugixa_inventory_edit capability (administrators have every inventory capability). With Pro Roles and permissions enforcing, their role must also allow editing this adjustment. Needs Plugixa Inventory Pro with the Inventory adjustments app on in Plugixa Inventory -> App Manager; with it off, this route answers 404. Finalizing also needs the plugixa_inventory_manage capability, which any user holding an inventory capability has.
This writes the ledger. Finalizing is the only way stock changes. It is all or nothing, and it cannot be undone: to correct a finalized document, finalize an opposite one.
Each line becomes one ledger row in the warehouse, typed adjustment_addition, adjustment_damage or adjustment_subtraction. addition adds; damage and subtraction take away.
Request
POST https://your-site.example/wp-json/plugixa-inventory/v1/adjustments/9/finalize
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The adjustment’s id |
Responses
200 OK. data is the finalized adjustment with its lines.
{
"success": true,
"data": {
"id": 9,
"reference": "ADJ-2026-0009",
"adjustment_type": "damage",
"warehouse_id": 1,
"adjustment_date": "2026-11-12 10:30:00",
"status": "finalized",
"finalized_at": "2026-11-12 10:15:00",
"finalized_by": 1,
"batch_id": "3f6c1a52-8d0e-4b7a-9c61-2f4e8a9b7d10",
"line_count": 1,
"total_quantity": 3.0,
"total_cost": 12.6,
"reason": "Leak in aisle 4",
"details": "",
"attachments": null,
"assigned_user_id": null,
"created_by": 1,
"modified_by": 1,
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 10:15:00",
"deleted_at": null,
"lines": [
{
"id": 31,
"adjustment_id": 9,
"item_id": 42,
"unit_id": null,
"quantity": 3.0,
"cost_per_unit": 4.2,
"total_cost": 12.6,
"transaction_id": 995,
"notes": "Water damage",
"position": 1,
"created_by": "1",
"modified_by": "1",
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 09:30:00",
"deleted_at": null,
"item_name": "Printer paper A4",
"item_sku": "PAP-A4",
"item_type": "consumable",
"unit_code": null
}
]
}
}
| Field | Type | Meaning |
|---|---|---|
data.status |
string |
finalized |
data.reference |
string |
Your reference, or ADJ-YYYY-NNNN |
data.batch_id |
string |
The id shared by the ledger rows this wrote |
data.total_cost |
number |
Sum of the line costs |
data.lines[].transaction_id |
integer |
The ledger row this line wrote |
This answer does not carry the warehouse names. Read the document again with Get Adjustment for those.
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_inventory_not_found |
No document with that id, or it is in the trash. |
409 |
plugixa_inventory_invalid_transition |
The document is already finalized. data.status_now is its status. |
422 |
plugixa_inventory_document_empty |
The document has no lines. |
422 |
plugixa_inventory_unknown_warehouse |
The warehouse no longer exists. |
422 |
plugixa_inventory_invalid_lines |
A line points at an item that no longer exists, or has a zero quantity. data.lines lists them with a reason. |
409 |
plugixa_inventory_insufficient_stock |
A decrease needs more than the warehouse holds. data.lines lists every short item with item_id, warehouse_id, available and requested. |
409 |
plugixa_inventory_stock_changed |
There was enough stock when checked, and not any more when written. Nothing was applied: try again. |
409 |
plugixa_inventory_too_many_layers / plugixa_inventory_costing_unavailable |
The costing method cannot cost a removal. Nothing was applied. |
503 |
plugixa_inventory_stock_busy |
Another stock operation is running. Try again in a moment. |
500 |
plugixa_inventory_stock_write_failed |
The stock change could not be written. Nothing was applied. |
409 |
plugixa_inventory_conflict |
You sent modified_at and the record has changed since. data.expected and data.current carry both values. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-inventory/v1/adjustments/9/finalize" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-inventory/v1/adjustments/9/finalize');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const response = await fetch('https://your-site.example/wp-json/plugixa-inventory/v1/adjustments/9/finalize', {
method: 'POST',
headers: { 'Authorization': auth },
});
const { data } = await response.json();
Quick Links
Share