retrieve - Stock Location Module Reference
This documentation provides a reference to the retrieve
method. This belongs to the Stock Location Module.
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
id
stringRequiredThe ID of the stock location
config
FindConfig<StockLocationDTO>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.
config
FindConfig<StockLocationDTO>select
or relations
, accept the
attributes or relations associated with a stock location.context
SharedContextA context used to share resources, such as transaction manager, between the application and the module.
context
SharedContextReturns
The stock location's details.
Was this section helpful?