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

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

# createTypes - Product Module Reference

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

This method is used to create a product type.

## Example

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

async function createProductType (value: string) {
  const productModule = await initializeProductModule()

  const productTypes = await productModule.createTypes([
    {
      value
    }
  ])

  // do something with the product types or return them
}
```

## Parameters

<ParameterTypes parameters={[
  {
    "name": "data",
    "type": "[CreateProductTypeDTO](../../product/interfaces/product.CreateProductTypeDTO.mdx)[]",
    "description": "The product types to be created.",
    "optional": false,
    "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": "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;[ProductTypeDTO](../../product/interfaces/product.ProductTypeDTO.mdx)[]&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "The list of created product types.",
    "expandable": false,
    "children": [
      {
        "name": "ProductTypeDTO[]",
        "type": "[ProductTypeDTO](../../product/interfaces/product.ProductTypeDTO.mdx)[]",
        "optional": false,
        "defaultValue": "",
        "description": "",
        "expandable": false,
        "children": [
          {
            "name": "ProductTypeDTO",
            "type": "`object`",
            "description": "A product type's data.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />
