@medusajs/stock-location
v2.22.3
Published
Stock Location Module for Medusa
Keywords
Readme
Stock Location Module for Medusa: manages stock locations (such as warehouses) and their addresses. It's installed and registered by default with @medusajs/medusa, so Medusa applications use it through the Modules.STOCK_LOCATION service rather than installing this package directly.
At a glance
| | |
| --- | --- |
| Package | @medusajs/stock-location |
| Type | Commerce Module |
| Module key | Modules.STOCK_LOCATION ("stock_location") |
| Registered by default | Yes |
| Import from | @medusajs/medusa/stock-location |
Installation
No installation needed. The module ships with @medusajs/medusa and is registered by defineConfig.
Usage
Resolve the module's service from the Medusa container, for example in a workflow step:
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { Modules } from "@medusajs/framework/utils"
const createStockLocationStep = createStep(
"create-stock-location",
async ({}, { container }) => {
const stockLocationModuleService = container.resolve(Modules.STOCK_LOCATION)
const stockLocation = await stockLocationModuleService.createStockLocations({
name: "Warehouse 1",
})
return new StepResponse({ stockLocation }, stockLocation.id)
}
)