Skip to main content
Skip to main content

createVariants - Product Module Reference

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

createVariants(data, sharedContext?): Promise<ProductVariantDTO[]>

This method is used to create product variants.

Example

const variants = await productModuleService.createVariants([
{
title: "Blue Shirt",
product_id: "prod_123",
options: {
Color: "Blue",
},
},
{
title: "Green Shirt",
product_id: "prod_321",
options: {
Color: "Green",
},
},
])

Parameters

The product variants to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<ProductVariantDTO[]>Required
The list of created product variants.

createVariants(data, sharedContext?): Promise<ProductVariantDTO>

This method is used to create a product variant.

Example

const variant = await productModuleService.createVariants({
title: "Blue Shirt",
product_id: "prod_123",
options: {
Color: "Blue",
},
})

Parameters

The product variant to be created.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

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