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