npm.io
2.22.7 • Published 4d ago

@medusajs/stock-location

Licence
MIT
Version
2.22.7
Deps
0
Size
56 kB
Vulns
0
Weekly
0
Stars
36.4K

Medusa logo

@medusajs/stock-location

Documentation | Website

Building blocks for digital commerce

Medusa is released under the MIT license. PRs welcome! Discord Chat Follow @medusajs

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)
  }
)

Resources