retrieve - Product Module Reference
BetaThis documentation provides a reference to the retrieve method. This belongs to the Product Module.
This method is used to retrieve a product by its ID
Example
A simple example that retrieves a product by its ID:
To specify relations that should be retrieved:
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrievePriceSet (priceSetId: string) {
const pricingService = await initializePricingModule()
const priceSet = await pricingService.retrieve(
priceSetId,
{
relations: ["money_amounts"]
}
)
// do something with the price set or return it
}
Parameters
productId
stringRequiredThe ID of the product to retrieve.
config
FindConfig<ProductDTO>The configurations determining how the product is retrieved. Its properties, such as select
or relations
, accept the attributes or relations associated with a product.
config
FindConfig<ProductDTO>select
or relations
, accept the attributes or relations associated with a product.sharedContext
ContextA context used to share resources, such as transaction manager, between the application and the module.
sharedContext
ContextReturns
The retrieved product.
Was this section helpful?