Skip to main content
Skip to main content

updateVariants - Product Module Reference

Beta

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

This method is used to update a product's variants.

Example

import {
initialize as initializeProductModule,
} from "@medusajs/product"
import {
UpdateProductVariantDTO
} from "@medusajs/product/dist/types/services/product-variant"

async function updateProductVariants (items: UpdateProductVariantDTO[]) {
const productModule = await initializeProductModule()

const productVariants = await productModule.updateVariants(items)

// do something with the product variants or return them
}

Parameters

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

Returns

PromisePromise<ProductVariantDTO[]>Required
The updated product variants's details.
Was this section helpful?