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

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

# update - Product Module Reference

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

This method is used to update a product.

## Example

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

async function updateProduct (id: string, title: string) {
  const productModule = await initializeProductModule()

  const products = await productModule.update([
    {
      id,
      title
    }
  ])

  // do something with the products or return them
}
```

## Parameters

<ParameterTypes parameters={[
  {
    "name": "data",
    "type": "[UpdateProductDTO](../../product/interfaces/product.UpdateProductDTO.mdx)[]",
    "description": "The products to be updated, each holding the attributes that should be updated in the product.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "categories",
        "type": "`object`[]",
        "description": "The product categories to associate with the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "id",
            "type": "`string`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "collection_id",
        "type": "`null` \\| `string`",
        "description": "The product collection to be associated with the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "description",
        "type": "`string`",
        "description": "The description of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "discountable",
        "type": "`boolean`",
        "description": "Whether the product can be discounted.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "handle",
        "type": "`string`",
        "description": "The handle of the product. The handle can be used to create slug URL paths.\nIf not supplied, the value of the `handle` attribute of the product is set to the slug version of the `title` attribute.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "height",
        "type": "`number`",
        "description": "The height of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "hs_code",
        "type": "`string`",
        "description": "The HS Code of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "id",
        "type": "`string`",
        "description": "The ID of the product to update.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "images",
        "type": "`string`[] \\| `object`[]",
        "description": "The product's images. If an array of strings is supplied, each string will be a URL and a `ProductImage` will be created\nand associated with the product. If an array of objects is supplied, you can pass along the ID of an existing `ProductImage`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "is_giftcard",
        "type": "`boolean`",
        "description": "Whether the product is a gift card.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "length",
        "type": "`number`",
        "description": "The length of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "material",
        "type": "`string`",
        "description": "The material of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "metadata",
        "type": "`Record<string, unknown>`",
        "description": "Holds custom data in key-value pairs.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "mid_code",
        "type": "`string`",
        "description": "The MID Code of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "options",
        "type": "[CreateProductOptionDTO](../../product/interfaces/product.CreateProductOptionDTO.mdx)[]",
        "description": "The product options to be created and associated with the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "product_id",
            "type": "`string`",
            "description": "The ID of the associated product.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "title",
            "type": "`string`",
            "description": "The product option's title.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "origin_country",
        "type": "`string`",
        "description": "The origin country of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "status",
        "type": "[ProductStatus](../../product/enums/product.ProductStatus.mdx)",
        "description": "The status of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "DRAFT",
            "type": "`\"draft\"`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "PROPOSED",
            "type": "`\"proposed\"`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "PUBLISHED",
            "type": "`\"published\"`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "REJECTED",
            "type": "`\"rejected\"`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "subtitle",
        "type": "`string`",
        "description": "The subttle of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "tags",
        "type": "[CreateProductTagDTO](../../product/interfaces/product.CreateProductTagDTO.mdx)[]",
        "description": "The product tags to be created and associated with the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "value",
            "type": "`string`",
            "description": "The value of the product tag.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "thumbnail",
        "type": "`string`",
        "description": "The URL of the product's thumbnail.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "title",
        "type": "`string`",
        "description": "The title of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "type",
        "type": "[CreateProductTypeDTO](../../product/interfaces/product.CreateProductTypeDTO.mdx)",
        "description": "The product type to create and associate with the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "id",
            "type": "`string`",
            "description": "The product type's ID.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "Holds custom data in key-value pairs.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "value",
            "type": "`string`",
            "description": "The product type's value.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "type_id",
        "type": "`null` \\| `string`",
        "description": "The product type to be associated with the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "variants",
        "type": "([CreateProductVariantDTO](../../product/interfaces/product.CreateProductVariantDTO.mdx) \\| [UpdateProductVariantDTO](../../product/interfaces/product.UpdateProductVariantDTO.mdx))[]",
        "description": "The product variants to be created and associated with the product. You can also update existing product variants associated with the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "weight",
        "type": "`number`",
        "description": "The weight of the product.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "width",
        "type": "`number`",
        "description": "The width of the product.",
        "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;[ProductDTO](../../product/interfaces/product.ProductDTO.mdx)[]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "The list of updated products.",
    "expandable": false,
    "children": [
      {
        "name": "ProductDTO[]",
        "type": "[ProductDTO](../../product/interfaces/product.ProductDTO.mdx)[]",
        "optional": false,
        "defaultValue": "",
        "description": "",
        "expandable": false,
        "children": [
          {
            "name": "ProductDTO",
            "type": "`object`",
            "description": "A product's data.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />
