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

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

# createOptions - Product Module Reference

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

This method is used to create product options.

## Example

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

async function createProductOption (title: string, productId: string) {
  const productModule = await initializeProductModule()

  const productOptions = await productModule.createOptions([
    {
      title,
      product_id: productId
    }
  ])

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

## Parameters

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