Contents
Delete Item - Plugixa Inventory
DELETE /plugixa-inventory/v1/items/{id}
Move an item to the trash. It can be brought back with Restore Item.
The user needs the plugixa_inventory_delete capability (administrators have every inventory capability). With Pro Roles and permissions enforcing, their role must also allow deleting this item.
Note. An item that has ever had stock cannot be trashed: stock on hand blocks it, and so does any row in the stock ledger, even with nothing left. Set
statustounpublishedinstead.
Request
DELETE https://your-site.example/wp-json/plugixa-inventory/v1/items/42
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The item’s id |
Responses
200 OK. The item is in the trash.
{
"success": true,
"data": {
"trashed": true
}
}
From now on it is left out of lists and single reads, and appears in List Items with view=trash.
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_inventory_not_found |
No item with that id, or it is in the trash. |
409 |
plugixa_inventory_item_in_use |
The item still has stock on hand, or has stock history. data.blockers lists each reason as a sentence. |
Plus the errors every endpoint can return.
Examples
curl -s -X DELETE "https://your-site.example/wp-json/plugixa-inventory/v1/items/42" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-inventory/v1/items/42');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
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/items/42', {
method: 'DELETE',
headers: { 'Authorization': auth },
});
const { data } = await response.json();
Quick Links
Share