Skip to main content
Skip to main content

createInventoryItem - Inventory Module Reference

This documentation provides a reference to the createInventoryItem method. This belongs to the Inventory Module.

This method is used to create an inventory item.

Example

import { 
initialize as initializeInventoryModule,
} from "@medusajs/inventory"

async function createInventoryItem (item: {
sku: string,
requires_shipping: boolean
}) {
const inventoryModule = await initializeInventoryModule({})

const inventoryItem = await inventoryModule.createInventoryItem(
item
)

// do something with the inventory item or return it
}

Parameters

The details of the inventory item to create.
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<InventoryItemDTO>Required
The created inventory item's details.
Was this section helpful?