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

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

# restoreVariants - Product Module Reference

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

This method is used to restore product varaints that were soft deleted. Product variants are soft deleted when they're not 
provided in a product's details passed to the [update](product.IProductModuleService.update.mdx) method.

## Example

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

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

  await productModule.restoreVariants(ids)
}
```

## Type Parameters

<ParameterTypes parameters={[
  {
    "name": "TReturnableLinkableKeys",
    "type": "`string`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

## Parameters

<ParameterTypes parameters={[
  {
    "name": "variantIds",
    "type": "`string`[]",
    "description": "The IDs of the variants to restore.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "config",
    "type": "[RestoreReturn](../../product/interfaces/product.RestoreReturn.mdx)&#60;TReturnableLinkableKeys&#62;",
    "description": "Configurations determining which relations to restore along with each of the product variants. You can pass to its `returnLinkableKeys`\nproperty any of the product variant's relation attribute names.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "returnLinkableKeys",
        "type": "`TReturnableLinkableKeys`[]",
        "description": "An array of strings, each being the ID attribute names of the entity's relations.",
        "optional": true,
        "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 \\| Record&#60;string, string[]&#62;&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "An object that includes the IDs of related records that were restored. The object's keys are the ID attribute names of the product variant entity's relations \nand its value is an array of strings, each being the ID of the record associated with the product variant through this relation.\n\nIf there are no related records that were restored, the promise resolved to `void`.",
    "expandable": false,
    "children": [
      {
        "name": "void \\| Record&#60;string, string[]&#62;",
        "type": "`void` \\| `Record<string, string[]>`",
        "optional": true,
        "defaultValue": "",
        "description": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />
