---
displayed_sidebar: productReference
badge:
  variant: orange
  text: Beta
slug: /references/product/deleteVariants
sidebar_label: deleteVariants
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# deleteVariants - Product Module Reference

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

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

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

  await productModule.deleteVariants(ids)
}
```

## Parameters

<ParameterTypes parameters={[
  {
    "name": "productVariantIds",
    "type": "`string`[]",
    "description": "The IDs of the ProductVariant to be deleted.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "sharedContext",
    "type": "[Context](../../product/interfaces/product.Context.mdx)",
    "description": "A context used to share resources, such as transaction manager, between the application and the module.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "enableNestedTransactions",
        "type": "`boolean`",
        "description": "A boolean value indicating whether nested transactions are enabled.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "isolationLevel",
        "type": "`string`",
        "description": "A string indicating the isolation level of the context. Possible values are `READ UNCOMMITTED`, `READ COMMITTED`, `REPEATABLE READ`, or `SERIALIZABLE`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "manager",
        "type": "`TManager`",
        "description": "An instance of a manager, typically an entity manager, of type `TManager`, which is a typed parameter passed to the context to specify the type of the `manager`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "transactionId",
        "type": "`string`",
        "description": "A string indicating the ID of the current transaction.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "transactionManager",
        "type": "`TManager`",
        "description": "An instance of a transaction manager of type `TManager`, which is a typed parameter passed to the context to specify the type of the `transactionManager`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

## Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;void&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves when the ProductVariant are successfully deleted.",
    "expandable": false,
    "children": []
  }
]} />
