createVariants - Product Module Reference
BetaThis documentation provides a reference to the createVariants method. This belongs to the Product Module.
This method is used to create variants for a product.
Example
import {
initialize as initializeProductModule,
} from "@medusajs/product"
async function createProductVariants (items: {
product_id: string,
title: string
}[]) {
const productModule = await initializeProductModule()
const productVariants = await productModule.createVariants(items)
// do something with the product variants or return them
}
Parameters
The product variants to create.
Returns
The created product variants' details.
Was this section helpful?