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