Skip to main content

Overview

The Stock Location Module manages physical warehouse and store locations where inventory is stocked. It provides location management capabilities essential for multi-location inventory tracking and fulfillment. Key Features:
  • Multiple stock location management
  • Location addresses with full details
  • Location metadata for customization
  • Integration with inventory tracking
  • Integration with fulfillment

When to Use

Use the Stock Location Module when you need to:
  • Manage multiple warehouses or stores
  • Track inventory at different locations
  • Support multi-location fulfillment
  • Store location addresses and contact info
  • Implement ship-from-store functionality
  • Handle distributed inventory
  • Configure location-specific settings

Data Models

StockLocation

Represents a physical location where inventory is stored.
string
required
Unique stock location identifier (prefix: sloc_)
string
required
Location name (e.g., “Main Warehouse”, “NYC Store”)
string
ID of the associated address
StockLocationAddress
Full location address
object
Additional custom data

StockLocationAddress

Address details for a stock location.
string
required
Unique address identifier
string
required
Address line 1
string
Address line 2
string
City
string
required
Two-letter ISO country code
string
State or province
string
Postal/ZIP code
string
Phone number
object
Additional custom data

Service Interface

The Stock Location Module service is available at @medusajs/medusa/stock-location.

Create Stock Location

Create a new stock location.
CreateStockLocationDTO | CreateStockLocationDTO[]
required
Stock location data
string
required
Location name
CreateStockLocationAddressDTO
Location address
object
Custom metadata
StockLocationDTO | StockLocationDTO[]
The created stock location(s)

Retrieve Stock Location

Get a stock location with its address.
string
required
The ID of the stock location to retrieve
FindConfig
Configuration for the query
string[]
Relations to load (e.g., ["address"])
StockLocationDTO
The retrieved stock location

List Stock Locations

List all stock locations.
FilterableStockLocationProps
Filters to apply
string | string[]
Filter by stock location IDs
string | string[]
Filter by name
StockLocationDTO[]
Array of stock locations

Update Stock Location

Modify a stock location.
string
required
ID of the stock location to update
UpdateStockLocationDTO
required
Fields to update
string
Location name
UpdateStockLocationAddressDTO
Address updates
object
Metadata updates

Delete Stock Location

Remove a stock location.

Integration Examples

With Inventory Module

Manage inventory at stock locations.

With Fulfillment Module

Create fulfillments from stock locations.

With Order Module

Fulfill orders from specific locations.

Common Scenarios

Multi-Warehouse Setup

Retail Store Locations

Drop Ship Locations

Best Practices

  1. Location Naming: Use clear, descriptive names that include:
    • Location type (warehouse, store, supplier)
    • Geographic identifier (city, region)
    • Purpose if applicable (returns center, outlet)
  2. Complete Addresses: Always provide complete address information including:
    • Full street address
    • City and province/state
    • Country code (two-letter ISO)
    • Postal code
    • Contact phone number
  3. Metadata Usage: Store location-specific settings in metadata:
    • Operating hours
    • Capacity limits
    • Location type
    • Special handling instructions
    • Ship-from-store capability
    • Regional identifiers
  4. Location Strategy: Plan your location structure based on:
    • Fulfillment speed requirements
    • Shipping cost optimization
    • Inventory distribution
    • Returns handling
  5. Integration: Link stock locations with:
    • Inventory levels (required)
    • Fulfillment providers
    • Service zones
    • Return locations
  6. Soft Deletes: Consider using metadata flags to “deactivate” locations instead of deleting them to preserve historical data.