Skip to main content
Skip to main content

retrieve

This method is used to retrieve a stock location by its ID

Example

A simple example that retrieves a inventory item by its ID:

import {
initialize as initializeStockLocationModule,
} from "@medusajs/stock-location"

async function retrieveStockLocation (id: string) {
const stockLocationModule = await initializeStockLocationModule({})

const stockLocation = await stockLocationModule.retrieve(id)

// do something with the stock location or return it
}

To specify relations that should be retrieved:

import {
initialize as initializeStockLocationModule,
} from "@medusajs/stock-location"

async function retrieveStockLocation (id: string) {
const stockLocationModule = await initializeStockLocationModule({})

const stockLocation = await stockLocationModule.retrieve(id, {
relations: ["address"]
})

// do something with the stock location or return it
}

Parameters

idstringRequired
The ID of the stock location
The configurations determining how the stock location is retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a stock location.
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<StockLocationDTO>Required
The stock location's details.
Was this section helpful?