Skip to main content
Skip to main content

retrieveVariant - Product Module Reference

This documentation provides a reference to the retrieveVariant method. This belongs to the Product Module.

This method is used to retrieve a product variant by its ID.

Example

A simple example that retrieves a product variant by its ID:

const variant =
await productModuleService.retrieveVariant("variant_123")

To specify relations that should be retrieved:

const variant = await productModuleService.retrieveVariant(
"variant_123",
{
relations: ["options"],
}
)

Parameters

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

Returns

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