Skip to main content
Skip to main content
You're viewing the documentation for v1, which isn't the latest Medusa version.Latest documentation

retrieve - Product Module Reference

Beta

This 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:

const product = await productModuleService.retrieve("prod_123")

To specify relations that should be retrieved:

const product = await productModuleService.retrieve("prod_123", {
relations: ["categories"],
})

Parameters​

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

Returns​

PromisePromise<ProductDTO>Required
The retrieved product.
Was this section helpful?