import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.inventoryItem.deleteLevel(
"iitem_123",
"sloc_123",
)
.then(({ deleted, parent: inventoryItem }) => {
console.log(deleted, inventoryItem)
}){
"id": "<string>",
"object": "<string>",
"deleted": true,
"parent": {
"id": "<string>",
"requires_shipping": true,
"sku": "<string>",
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"weight": 123,
"length": 123,
"height": 123,
"width": 123,
"title": "<string>",
"description": "<string>",
"thumbnail": "<string>",
"metadata": {},
"location_levels": [
{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"incoming_quantity": 123,
"metadata": {},
"available_quantity": 123,
"inventory_item": {}
}
]
}
}Remove the inventory level of an inventory item.
If the inventory level has reserved quantity greater than 0, an error is thrown.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.inventoryItem.deleteLevel(
"iitem_123",
"sloc_123",
)
.then(({ deleted, parent: inventoryItem }) => {
console.log(deleted, inventoryItem)
}){
"id": "<string>",
"object": "<string>",
"deleted": true,
"parent": {
"id": "<string>",
"requires_shipping": true,
"sku": "<string>",
"origin_country": "<string>",
"hs_code": "<string>",
"mid_code": "<string>",
"material": "<string>",
"weight": 123,
"length": 123,
"height": 123,
"width": 123,
"title": "<string>",
"description": "<string>",
"thumbnail": "<string>",
"metadata": {},
"location_levels": [
{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"inventory_item_id": "<string>",
"location_id": "<string>",
"stocked_quantity": 123,
"reserved_quantity": 123,
"incoming_quantity": 123,
"metadata": {},
"available_quantity": 123,
"inventory_item": {}
}
]
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The inventory item's ID.
The inventory item's location id.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
OK
The deletion's details.
The inventory item's ID.
The name of the deleted object.
Whether the Inventory Item was deleted.
The inventory item's details.
Show child attributes
The inventory item's ID.
Whether the inventory item requires shipping.
The inventory item's sku.
The inventory item's origin country.
The inventory item's HS code.
The inventory item's MID code.
The inventory item's material.
The inventory item's weight.
The inventory item's length.
The inventory item's height.
The inventory item's width.
The inventory item's title.
The inventory item's description.
The thumbnail URL of the inventory item.
Custom key-value pairs, used to store additional information about the inventory item.
The inventory item's location levels.
Show child attributes
The location level's ID.
The location level's created at.
The location level's updated at.
The location level's deleted at.
The location level's inventory item id.
The location level's location id.
The location level's stocked quantity.
The location level's reserved quantity.
The location level's incoming quantity.
The location level's metadata.
The location level's available quantity.