Skip to main content
Skip to main content

deleteVariants - Product Module Reference

Beta

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

This method is used to delete ProductVariant. This method will completely remove the ProductVariant and they can no longer be accessed or retrieved.

Example

import {
initialize as initializeProductModule,
} from "@medusajs/product"

async function deleteProducts (ids: string[]) {
const productModule = await initializeProductModule()

await productModule.deleteVariants(ids)
}

Parameters

productVariantIdsstring[]Required
The IDs of the ProductVariant to be deleted.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<void>Required
Resolves when the ProductVariant are successfully deleted.
Was this section helpful?