# productOptionsCreate - admin-graphql - MUTATION
Version: unstable

## Description
Creates options on a product.

### Access Scopes
`write_products` access scope. Also: The user must have a permission to create product variants.


## Arguments
* [options](/docs/api/admin-graphql/unstable/input-objects/OptionCreateInput): OptionCreateInput! - Options to add to the product.
* [productId](/docs/api/admin-graphql/unstable/scalars/ID): ID! - The ID of the product to update.
* [variantStrategy](/docs/api/admin-graphql/unstable/enums/ProductOptionCreateVariantStrategy): ProductOptionCreateVariantStrategy - The strategy defines which behavior the mutation should observe regarding variants.
If not provided or set to null, the strategy `LEAVE_AS_IS` will be used.


## Returns
* [product](/docs/api/admin-graphql/unstable/objects/Product): Product The updated product object.
* [userErrors](/docs/api/admin-graphql/unstable/objects/ProductOptionsCreateUserError): ProductOptionsCreateUserError! The list of errors that occurred from executing the mutation.


## Examples
### Create a product option linked to a metafield
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) { productOptionsCreate(productId: $productId, options: $options) { userErrors { field message code } product { options { name linkedMetafield { namespace key } optionValues { name linkedMetafieldValue } } } } }\",\n \"variables\": {\n    \"productId\": \"gid://shopify/Product/1072481128\",\n    \"options\": [\n      {\n        \"name\": \"Color\",\n        \"linkedMetafield\": {\n          \"namespace\": \"shopify\",\n          \"key\": \"color-pattern\",\n          \"values\": [\n            \"gid://shopify/Metaobject/971662503\",\n            \"gid://shopify/Metaobject/971662504\",\n            \"gid://shopify/Metaobject/971662505\"\n          ]\n        }\n      }\n    ]\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) {\n      productOptionsCreate(productId: $productId, options: $options) {\n        userErrors {\n          field\n          message\n          code\n        }\n        product {\n          options {\n            name\n            linkedMetafield {\n              namespace\n              key\n            }\n            optionValues {\n              name\n              linkedMetafieldValue\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"productId\": \"gid://shopify/Product/1072481128\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"linkedMetafield\": {\n            \"namespace\": \"shopify\",\n            \"key\": \"color-pattern\",\n            \"values\": [\n              \"gid://shopify/Metaobject/971662503\",\n              \"gid://shopify/Metaobject/971662504\",\n              \"gid://shopify/Metaobject/971662505\"\n            ]\n          }\n        }\n      ]\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) {\n    productOptionsCreate(productId: $productId, options: $options) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        options {\n          name\n          linkedMetafield {\n            namespace\n            key\n          }\n          optionValues {\n            name\n            linkedMetafieldValue\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"productId\": \"gid://shopify/Product/1072481128\",\n  \"options\": [{\"name\"=>\"Color\", \"linkedMetafield\"=>{\"namespace\"=>\"shopify\", \"key\"=>\"color-pattern\", \"values\"=>[\"gid://shopify/Metaobject/971662503\", \"gid://shopify/Metaobject/971662504\", \"gid://shopify/Metaobject/971662505\"]}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) {\n    productOptionsCreate(productId: $productId, options: $options) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        options {\n          name\n          linkedMetafield {\n            namespace\n            key\n          }\n          optionValues {\n            name\n            linkedMetafieldValue\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"productId\": \"gid://shopify/Product/1072481128\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"linkedMetafield\": {\n            \"namespace\": \"shopify\",\n            \"key\": \"color-pattern\",\n            \"values\": [\n              \"gid://shopify/Metaobject/971662503\",\n              \"gid://shopify/Metaobject/971662504\",\n              \"gid://shopify/Metaobject/971662505\"\n            ]\n          }\n        }\n      ]\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) {\n  productOptionsCreate(productId: $productId, options: $options) {\n    userErrors {\n      field\n      message\n      code\n    }\n    product {\n      options {\n        name\n        linkedMetafield {\n          namespace\n          key\n        }\n        optionValues {\n          name\n          linkedMetafieldValue\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "productId": "gid://shopify/Product/1072481128",
  "options": [
    {
      "name": "Color",
      "linkedMetafield": {
        "namespace": "shopify",
        "key": "color-pattern",
        "values": [
          "gid://shopify/Metaobject/971662503",
          "gid://shopify/Metaobject/971662504",
          "gid://shopify/Metaobject/971662505"
        ]
      }
    }
  ]
}
#### Graphql Response
{
  "data": {
    "productOptionsCreate": {
      "userErrors": [],
      "product": {
        "options": [
          {
            "name": "Color",
            "linkedMetafield": {
              "namespace": "shopify",
              "key": "color-pattern"
            },
            "optionValues": [
              {
                "name": "Red",
                "linkedMetafieldValue": "gid://shopify/Metaobject/971662503"
              },
              {
                "name": "Blue",
                "linkedMetafieldValue": "gid://shopify/Metaobject/971662504"
              },
              {
                "name": "Yellow",
                "linkedMetafieldValue": "gid://shopify/Metaobject/971662505"
              }
            ]
          }
        ]
      }
    }
  }
}

### Create a product option linked to a metafield (with existing values)
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) { productOptionsCreate(productId: $productId, options: $options) { userErrors { field message code } product { options { name linkedMetafield { namespace key } optionValues { name linkedMetafieldValue } } } } }\",\n \"variables\": {\n    \"productId\": \"gid://shopify/Product/1072481129\",\n    \"options\": [\n      {\n        \"name\": \"Color\",\n        \"linkedMetafield\": {\n          \"namespace\": \"shopify\",\n          \"key\": \"color-pattern\"\n        }\n      }\n    ]\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) {\n      productOptionsCreate(productId: $productId, options: $options) {\n        userErrors {\n          field\n          message\n          code\n        }\n        product {\n          options {\n            name\n            linkedMetafield {\n              namespace\n              key\n            }\n            optionValues {\n              name\n              linkedMetafieldValue\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"productId\": \"gid://shopify/Product/1072481129\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"linkedMetafield\": {\n            \"namespace\": \"shopify\",\n            \"key\": \"color-pattern\"\n          }\n        }\n      ]\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) {\n    productOptionsCreate(productId: $productId, options: $options) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        options {\n          name\n          linkedMetafield {\n            namespace\n            key\n          }\n          optionValues {\n            name\n            linkedMetafieldValue\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"productId\": \"gid://shopify/Product/1072481129\",\n  \"options\": [{\"name\"=>\"Color\", \"linkedMetafield\"=>{\"namespace\"=>\"shopify\", \"key\"=>\"color-pattern\"}}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) {\n    productOptionsCreate(productId: $productId, options: $options) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        options {\n          name\n          linkedMetafield {\n            namespace\n            key\n          }\n          optionValues {\n            name\n            linkedMetafieldValue\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"productId\": \"gid://shopify/Product/1072481129\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"linkedMetafield\": {\n            \"namespace\": \"shopify\",\n            \"key\": \"color-pattern\"\n          }\n        }\n      ]\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!) {\n  productOptionsCreate(productId: $productId, options: $options) {\n    userErrors {\n      field\n      message\n      code\n    }\n    product {\n      options {\n        name\n        linkedMetafield {\n          namespace\n          key\n        }\n        optionValues {\n          name\n          linkedMetafieldValue\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "productId": "gid://shopify/Product/1072481129",
  "options": [
    {
      "name": "Color",
      "linkedMetafield": {
        "namespace": "shopify",
        "key": "color-pattern"
      }
    }
  ]
}
#### Graphql Response
{
  "data": {
    "productOptionsCreate": {
      "userErrors": [],
      "product": {
        "options": [
          {
            "name": "Color",
            "linkedMetafield": {
              "namespace": "shopify",
              "key": "color-pattern"
            },
            "optionValues": [
              {
                "name": "Red",
                "linkedMetafieldValue": "gid://shopify/Metaobject/971662506"
              },
              {
                "name": "Blue",
                "linkedMetafieldValue": "gid://shopify/Metaobject/971662507"
              },
              {
                "name": "Yellow",
                "linkedMetafieldValue": "gid://shopify/Metaobject/971662508"
              }
            ]
          }
        ]
      }
    }
  }
}

### Create new product option and variants with CREATE variantStrategy
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) { productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) { userErrors { field message code } product { id variants(first: 10) { nodes { id title selectedOptions { name value } } } options { id name values position optionValues { id name hasVariants } } } } }\",\n \"variables\": {\n    \"productId\": \"gid://shopify/Product/20995642\",\n    \"options\": [\n      {\n        \"name\": \"Color\",\n        \"values\": [\n          {\n            \"name\": \"Blue\"\n          },\n          {\n            \"name\": \"Green\"\n          }\n        ]\n      }\n    ],\n    \"variantStrategy\": \"CREATE\"\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n      productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n        userErrors {\n          field\n          message\n          code\n        }\n        product {\n          id\n          variants(first: 10) {\n            nodes {\n              id\n              title\n              selectedOptions {\n                name\n                value\n              }\n            }\n          }\n          options {\n            id\n            name\n            values\n            position\n            optionValues {\n              id\n              name\n              hasVariants\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            },\n            {\n              \"name\": \"Green\"\n            }\n          ]\n        }\n      ],\n      \"variantStrategy\": \"CREATE\"\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"productId\": \"gid://shopify/Product/20995642\",\n  \"options\": [{\"name\"=>\"Color\", \"values\"=>[{\"name\"=>\"Blue\"}, {\"name\"=>\"Green\"}]}],\n  \"variantStrategy\": \"CREATE\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            },\n            {\n              \"name\": \"Green\"\n            }\n          ]\n        }\n      ],\n      \"variantStrategy\": \"CREATE\"\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n  productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n    userErrors {\n      field\n      message\n      code\n    }\n    product {\n      id\n      variants(first: 10) {\n        nodes {\n          id\n          title\n          selectedOptions {\n            name\n            value\n          }\n        }\n      }\n      options {\n        id\n        name\n        values\n        position\n        optionValues {\n          id\n          name\n          hasVariants\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "productId": "gid://shopify/Product/20995642",
  "options": [
    {
      "name": "Color",
      "values": [
        {
          "name": "Blue"
        },
        {
          "name": "Green"
        }
      ]
    }
  ],
  "variantStrategy": "CREATE"
}
#### Graphql Response
{
  "data": {
    "productOptionsCreate": {
      "userErrors": [],
      "product": {
        "id": "gid://shopify/Product/20995642",
        "variants": {
          "nodes": [
            {
              "id": "gid://shopify/ProductVariant/30322695",
              "title": "151cm / Blue",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "151cm"
                },
                {
                  "name": "Color",
                  "value": "Blue"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/113711323",
              "title": "155cm / Blue",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "155cm"
                },
                {
                  "name": "Color",
                  "value": "Blue"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/236948360",
              "title": "158cm / Blue",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "158cm"
                },
                {
                  "name": "Color",
                  "value": "Blue"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/1070325228",
              "title": "151cm / Green",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "151cm"
                },
                {
                  "name": "Color",
                  "value": "Green"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/1070325229",
              "title": "155cm / Green",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "155cm"
                },
                {
                  "name": "Color",
                  "value": "Green"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/1070325230",
              "title": "158cm / Green",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "158cm"
                },
                {
                  "name": "Color",
                  "value": "Green"
                }
              ]
            }
          ]
        },
        "options": [
          {
            "id": "gid://shopify/ProductOption/328272167",
            "name": "Title",
            "values": [
              "151cm",
              "155cm",
              "158cm"
            ],
            "position": 1,
            "optionValues": [
              {
                "name": "151cm",
                "hasVariants": true
              },
              {
                "name": "155cm",
                "hasVariants": true
              },
              {
                "name": "158cm",
                "hasVariants": true
              }
            ]
          },
          {
            "id": "gid://shopify/ProductOption/1064576618",
            "name": "Color",
            "values": [
              "Blue",
              "Green"
            ],
            "position": 2,
            "optionValues": [
              {
                "name": "Blue",
                "hasVariants": true
              },
              {
                "name": "Green",
                "hasVariants": true
              }
            ]
          }
        ]
      }
    }
  }
}

### Create new product option but no new variants with LEAVE_AS_IS variantStrategy
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) { productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) { userErrors { field message code } product { id variants(first: 10) { nodes { id title selectedOptions { name value } } } options { id name values position optionValues { id name hasVariants } } } } }\",\n \"variables\": {\n    \"productId\": \"gid://shopify/Product/20995642\",\n    \"options\": [\n      {\n        \"name\": \"Color\",\n        \"values\": [\n          {\n            \"name\": \"Blue\"\n          },\n          {\n            \"name\": \"Green\"\n          }\n        ]\n      }\n    ],\n    \"variantStrategy\": \"LEAVE_AS_IS\"\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n      productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n        userErrors {\n          field\n          message\n          code\n        }\n        product {\n          id\n          variants(first: 10) {\n            nodes {\n              id\n              title\n              selectedOptions {\n                name\n                value\n              }\n            }\n          }\n          options {\n            id\n            name\n            values\n            position\n            optionValues {\n              id\n              name\n              hasVariants\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            },\n            {\n              \"name\": \"Green\"\n            }\n          ]\n        }\n      ],\n      \"variantStrategy\": \"LEAVE_AS_IS\"\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"productId\": \"gid://shopify/Product/20995642\",\n  \"options\": [{\"name\"=>\"Color\", \"values\"=>[{\"name\"=>\"Blue\"}, {\"name\"=>\"Green\"}]}],\n  \"variantStrategy\": \"LEAVE_AS_IS\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            },\n            {\n              \"name\": \"Green\"\n            }\n          ]\n        }\n      ],\n      \"variantStrategy\": \"LEAVE_AS_IS\"\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n  productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n    userErrors {\n      field\n      message\n      code\n    }\n    product {\n      id\n      variants(first: 10) {\n        nodes {\n          id\n          title\n          selectedOptions {\n            name\n            value\n          }\n        }\n      }\n      options {\n        id\n        name\n        values\n        position\n        optionValues {\n          id\n          name\n          hasVariants\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "productId": "gid://shopify/Product/20995642",
  "options": [
    {
      "name": "Color",
      "values": [
        {
          "name": "Blue"
        },
        {
          "name": "Green"
        }
      ]
    }
  ],
  "variantStrategy": "LEAVE_AS_IS"
}
#### Graphql Response
{
  "data": {
    "productOptionsCreate": {
      "userErrors": [],
      "product": {
        "id": "gid://shopify/Product/20995642",
        "variants": {
          "nodes": [
            {
              "id": "gid://shopify/ProductVariant/30322695",
              "title": "151cm / Blue",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "151cm"
                },
                {
                  "name": "Color",
                  "value": "Blue"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/113711323",
              "title": "155cm / Blue",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "155cm"
                },
                {
                  "name": "Color",
                  "value": "Blue"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/236948360",
              "title": "158cm / Blue",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "158cm"
                },
                {
                  "name": "Color",
                  "value": "Blue"
                }
              ]
            }
          ]
        },
        "options": [
          {
            "id": "gid://shopify/ProductOption/328272167",
            "name": "Title",
            "values": [
              "151cm",
              "155cm",
              "158cm"
            ],
            "position": 1,
            "optionValues": [
              {
                "name": "151cm",
                "hasVariants": true
              },
              {
                "name": "155cm",
                "hasVariants": true
              },
              {
                "name": "158cm",
                "hasVariants": true
              }
            ]
          },
          {
            "id": "gid://shopify/ProductOption/1064576620",
            "name": "Color",
            "values": [
              "Blue"
            ],
            "position": 2,
            "optionValues": [
              {
                "name": "Blue",
                "hasVariants": true
              },
              {
                "name": "Green",
                "hasVariants": false
              }
            ]
          }
        ]
      }
    }
  }
}

### Create new product option with an explicit position
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) { productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) { userErrors { field message code } product { id variants(first: 10) { nodes { id title selectedOptions { name value } } } options { id name values position optionValues { id name hasVariants } } } } }\",\n \"variables\": {\n    \"productId\": \"gid://shopify/Product/20995642\",\n    \"options\": [\n      {\n        \"name\": \"Color\",\n        \"position\": 1,\n        \"values\": [\n          {\n            \"name\": \"Blue\"\n          }\n        ]\n      }\n    ]\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n      productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n        userErrors {\n          field\n          message\n          code\n        }\n        product {\n          id\n          variants(first: 10) {\n            nodes {\n              id\n              title\n              selectedOptions {\n                name\n                value\n              }\n            }\n          }\n          options {\n            id\n            name\n            values\n            position\n            optionValues {\n              id\n              name\n              hasVariants\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"position\": 1,\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            }\n          ]\n        }\n      ]\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"productId\": \"gid://shopify/Product/20995642\",\n  \"options\": [{\"name\"=>\"Color\", \"position\"=>1, \"values\"=>[{\"name\"=>\"Blue\"}]}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"position\": 1,\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            }\n          ]\n        }\n      ]\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n  productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n    userErrors {\n      field\n      message\n      code\n    }\n    product {\n      id\n      variants(first: 10) {\n        nodes {\n          id\n          title\n          selectedOptions {\n            name\n            value\n          }\n        }\n      }\n      options {\n        id\n        name\n        values\n        position\n        optionValues {\n          id\n          name\n          hasVariants\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "productId": "gid://shopify/Product/20995642",
  "options": [
    {
      "name": "Color",
      "position": 1,
      "values": [
        {
          "name": "Blue"
        }
      ]
    }
  ]
}
#### Graphql Response
{
  "data": {
    "productOptionsCreate": {
      "userErrors": [],
      "product": {
        "id": "gid://shopify/Product/20995642",
        "variants": {
          "nodes": [
            {
              "id": "gid://shopify/ProductVariant/30322695",
              "title": "Blue / 151cm",
              "selectedOptions": [
                {
                  "name": "Color",
                  "value": "Blue"
                },
                {
                  "name": "Title",
                  "value": "151cm"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/113711323",
              "title": "Blue / 155cm",
              "selectedOptions": [
                {
                  "name": "Color",
                  "value": "Blue"
                },
                {
                  "name": "Title",
                  "value": "155cm"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/236948360",
              "title": "Blue / 158cm",
              "selectedOptions": [
                {
                  "name": "Color",
                  "value": "Blue"
                },
                {
                  "name": "Title",
                  "value": "158cm"
                }
              ]
            }
          ]
        },
        "options": [
          {
            "id": "gid://shopify/ProductOption/1064576621",
            "name": "Color",
            "values": [
              "Blue"
            ],
            "position": 1,
            "optionValues": [
              {
                "name": "Blue",
                "hasVariants": true
              }
            ]
          },
          {
            "id": "gid://shopify/ProductOption/328272167",
            "name": "Title",
            "values": [
              "151cm",
              "155cm",
              "158cm"
            ],
            "position": 2,
            "optionValues": [
              {
                "name": "151cm",
                "hasVariants": true
              },
              {
                "name": "155cm",
                "hasVariants": true
              },
              {
                "name": "158cm",
                "hasVariants": true
              }
            ]
          }
        ]
      }
    }
  }
}

### Create new product options
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) { productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) { userErrors { field message code } product { id variants(first: 10) { nodes { id title selectedOptions { name value } } } options { id name values position optionValues { id name hasVariants } } } } }\",\n \"variables\": {\n    \"productId\": \"gid://shopify/Product/1072481130\",\n    \"options\": [\n      {\n        \"name\": \"Color\",\n        \"values\": [\n          {\n            \"name\": \"Blue\"\n          },\n          {\n            \"name\": \"Red\"\n          }\n        ]\n      },\n      {\n        \"name\": \"Size\",\n        \"values\": [\n          {\n            \"name\": \"Small\"\n          },\n          {\n            \"name\": \"Medium\"\n          }\n        ]\n      }\n    ]\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n      productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n        userErrors {\n          field\n          message\n          code\n        }\n        product {\n          id\n          variants(first: 10) {\n            nodes {\n              id\n              title\n              selectedOptions {\n                name\n                value\n              }\n            }\n          }\n          options {\n            id\n            name\n            values\n            position\n            optionValues {\n              id\n              name\n              hasVariants\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"productId\": \"gid://shopify/Product/1072481130\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            },\n            {\n              \"name\": \"Red\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Size\",\n          \"values\": [\n            {\n              \"name\": \"Small\"\n            },\n            {\n              \"name\": \"Medium\"\n            }\n          ]\n        }\n      ]\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"productId\": \"gid://shopify/Product/1072481130\",\n  \"options\": [{\"name\"=>\"Color\", \"values\"=>[{\"name\"=>\"Blue\"}, {\"name\"=>\"Red\"}]}, {\"name\"=>\"Size\", \"values\"=>[{\"name\"=>\"Small\"}, {\"name\"=>\"Medium\"}]}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"productId\": \"gid://shopify/Product/1072481130\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            },\n            {\n              \"name\": \"Red\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Size\",\n          \"values\": [\n            {\n              \"name\": \"Small\"\n            },\n            {\n              \"name\": \"Medium\"\n            }\n          ]\n        }\n      ]\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n  productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n    userErrors {\n      field\n      message\n      code\n    }\n    product {\n      id\n      variants(first: 10) {\n        nodes {\n          id\n          title\n          selectedOptions {\n            name\n            value\n          }\n        }\n      }\n      options {\n        id\n        name\n        values\n        position\n        optionValues {\n          id\n          name\n          hasVariants\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "productId": "gid://shopify/Product/1072481130",
  "options": [
    {
      "name": "Color",
      "values": [
        {
          "name": "Blue"
        },
        {
          "name": "Red"
        }
      ]
    },
    {
      "name": "Size",
      "values": [
        {
          "name": "Small"
        },
        {
          "name": "Medium"
        }
      ]
    }
  ]
}
#### Graphql Response
{
  "data": {
    "productOptionsCreate": {
      "userErrors": [],
      "product": {
        "id": "gid://shopify/Product/1072481130",
        "variants": {
          "nodes": [
            {
              "id": "gid://shopify/ProductVariant/1070325231",
              "title": "Blue / Small",
              "selectedOptions": [
                {
                  "name": "Color",
                  "value": "Blue"
                },
                {
                  "name": "Size",
                  "value": "Small"
                }
              ]
            }
          ]
        },
        "options": [
          {
            "id": "gid://shopify/ProductOption/1064576626",
            "name": "Color",
            "values": [
              "Blue"
            ],
            "position": 1,
            "optionValues": [
              {
                "name": "Blue",
                "hasVariants": true
              },
              {
                "name": "Red",
                "hasVariants": false
              }
            ]
          },
          {
            "id": "gid://shopify/ProductOption/1064576627",
            "name": "Size",
            "values": [
              "Small"
            ],
            "position": 2,
            "optionValues": [
              {
                "name": "Small",
                "hasVariants": true
              },
              {
                "name": "Medium",
                "hasVariants": false
              }
            ]
          }
        ]
      }
    }
  }
}

### Trying to create an option with a name that already exists on the product returns an error
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) { productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) { userErrors { field message code } product { id variants(first: 10) { nodes { id title selectedOptions { name value } } } options { id name values position optionValues { id name hasVariants } } } } }\",\n \"variables\": {\n    \"productId\": \"gid://shopify/Product/20995642\",\n    \"options\": [\n      {\n        \"name\": \"Color\",\n        \"values\": [\n          {\n            \"name\": \"Blue\"\n          }\n        ]\n      }\n    ]\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n      productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n        userErrors {\n          field\n          message\n          code\n        }\n        product {\n          id\n          variants(first: 10) {\n            nodes {\n              id\n              title\n              selectedOptions {\n                name\n                value\n              }\n            }\n          }\n          options {\n            id\n            name\n            values\n            position\n            optionValues {\n              id\n              name\n              hasVariants\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            }\n          ]\n        }\n      ]\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"productId\": \"gid://shopify/Product/20995642\",\n  \"options\": [{\"name\"=>\"Color\", \"values\"=>[{\"name\"=>\"Blue\"}]}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            }\n          ]\n        }\n      ]\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n  productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n    userErrors {\n      field\n      message\n      code\n    }\n    product {\n      id\n      variants(first: 10) {\n        nodes {\n          id\n          title\n          selectedOptions {\n            name\n            value\n          }\n        }\n      }\n      options {\n        id\n        name\n        values\n        position\n        optionValues {\n          id\n          name\n          hasVariants\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "productId": "gid://shopify/Product/20995642",
  "options": [
    {
      "name": "Color",
      "values": [
        {
          "name": "Blue"
        }
      ]
    }
  ]
}
#### Graphql Response
{
  "data": {
    "productOptionsCreate": {
      "userErrors": [
        {
          "field": [
            "options",
            "0"
          ],
          "message": "Option 'Color' already exists.",
          "code": "OPTION_ALREADY_EXISTS"
        }
      ],
      "product": {
        "id": "gid://shopify/Product/20995642",
        "variants": {
          "nodes": [
            {
              "id": "gid://shopify/ProductVariant/30322695",
              "title": "151cm / Green",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "151cm"
                },
                {
                  "name": "Color",
                  "value": "Green"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/113711323",
              "title": "155cm / Green",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "155cm"
                },
                {
                  "name": "Color",
                  "value": "Green"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/236948360",
              "title": "158cm / Green",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "158cm"
                },
                {
                  "name": "Color",
                  "value": "Green"
                }
              ]
            }
          ]
        },
        "options": [
          {
            "id": "gid://shopify/ProductOption/328272167",
            "name": "Title",
            "values": [
              "151cm",
              "155cm",
              "158cm"
            ],
            "position": 1,
            "optionValues": [
              {
                "id": "gid://shopify/ProductOptionValue/141051426",
                "name": "151cm",
                "hasVariants": true
              },
              {
                "id": "gid://shopify/ProductOptionValue/258076414",
                "name": "155cm",
                "hasVariants": true
              },
              {
                "id": "gid://shopify/ProductOptionValue/129596849",
                "name": "158cm",
                "hasVariants": true
              }
            ]
          },
          {
            "id": "gid://shopify/ProductOption/1064576623",
            "name": "Color",
            "values": [
              "Green"
            ],
            "position": 2,
            "optionValues": [
              {
                "id": "gid://shopify/ProductOptionValue/1054672491",
                "name": "Green",
                "hasVariants": true
              }
            ]
          }
        ]
      }
    }
  }
}

### Trying to create too many options returns an error
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) { productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) { userErrors { field message code } product { id variants(first: 10) { nodes { id title selectedOptions { name value } } } options { id name values position optionValues { id name hasVariants } } } } }\",\n \"variables\": {\n    \"productId\": \"gid://shopify/Product/20995642\",\n    \"options\": [\n      {\n        \"name\": \"Color\",\n        \"values\": [\n          {\n            \"name\": \"Blue\"\n          }\n        ]\n      },\n      {\n        \"name\": \"Style\",\n        \"values\": [\n          {\n            \"name\": \"Classic\"\n          }\n        ]\n      },\n      {\n        \"name\": \"Size\",\n        \"values\": [\n          {\n            \"name\": \"Small\"\n          }\n        ]\n      },\n      {\n        \"name\": \"Material\",\n        \"values\": [\n          {\n            \"name\": \"Linen\"\n          }\n        ]\n      }\n    ]\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n      productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n        userErrors {\n          field\n          message\n          code\n        }\n        product {\n          id\n          variants(first: 10) {\n            nodes {\n              id\n              title\n              selectedOptions {\n                name\n                value\n              }\n            }\n          }\n          options {\n            id\n            name\n            values\n            position\n            optionValues {\n              id\n              name\n              hasVariants\n            }\n          }\n        }\n      }\n    }`,\n    \"variables\": {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Style\",\n          \"values\": [\n            {\n              \"name\": \"Classic\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Size\",\n          \"values\": [\n            {\n              \"name\": \"Small\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Material\",\n          \"values\": [\n            {\n              \"name\": \"Linen\"\n            }\n          ]\n        }\n      ]\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }\nQUERY\n\nvariables = {\n  \"productId\": \"gid://shopify/Product/20995642\",\n  \"options\": [{\"name\"=>\"Color\", \"values\"=>[{\"name\"=>\"Blue\"}]}, {\"name\"=>\"Style\", \"values\"=>[{\"name\"=>\"Classic\"}]}, {\"name\"=>\"Size\", \"values\"=>[{\"name\"=>\"Small\"}]}, {\"name\"=>\"Material\", \"values\"=>[{\"name\"=>\"Linen\"}]}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n    productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n      userErrors {\n        field\n        message\n        code\n      }\n      product {\n        id\n        variants(first: 10) {\n          nodes {\n            id\n            title\n            selectedOptions {\n              name\n              value\n            }\n          }\n        }\n        options {\n          id\n          name\n          values\n          position\n          optionValues {\n            id\n            name\n            hasVariants\n          }\n        }\n      }\n    }\n  }`,\n  {\n    variables: {\n      \"productId\": \"gid://shopify/Product/20995642\",\n      \"options\": [\n        {\n          \"name\": \"Color\",\n          \"values\": [\n            {\n              \"name\": \"Blue\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Style\",\n          \"values\": [\n            {\n              \"name\": \"Classic\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Size\",\n          \"values\": [\n            {\n              \"name\": \"Small\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Material\",\n          \"values\": [\n            {\n              \"name\": \"Linen\"\n            }\n          ]\n        }\n      ]\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation createOptions($productId: ID!, $options: [OptionCreateInput!]!, $variantStrategy: ProductOptionCreateVariantStrategy) {\n  productOptionsCreate(productId: $productId, options: $options, variantStrategy: $variantStrategy) {\n    userErrors {\n      field\n      message\n      code\n    }\n    product {\n      id\n      variants(first: 10) {\n        nodes {\n          id\n          title\n          selectedOptions {\n            name\n            value\n          }\n        }\n      }\n      options {\n        id\n        name\n        values\n        position\n        optionValues {\n          id\n          name\n          hasVariants\n        }\n      }\n    }\n  }\n}"
#### Graphql Input
{
  "productId": "gid://shopify/Product/20995642",
  "options": [
    {
      "name": "Color",
      "values": [
        {
          "name": "Blue"
        }
      ]
    },
    {
      "name": "Style",
      "values": [
        {
          "name": "Classic"
        }
      ]
    },
    {
      "name": "Size",
      "values": [
        {
          "name": "Small"
        }
      ]
    },
    {
      "name": "Material",
      "values": [
        {
          "name": "Linen"
        }
      ]
    }
  ]
}
#### Graphql Response
{
  "data": {
    "productOptionsCreate": {
      "userErrors": [
        {
          "field": [
            "options"
          ],
          "message": "Can only specify a maximum of 3 options",
          "code": "OPTIONS_OVER_LIMIT"
        }
      ],
      "product": {
        "id": "gid://shopify/Product/20995642",
        "variants": {
          "nodes": [
            {
              "id": "gid://shopify/ProductVariant/30322695",
              "title": "151cm",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "151cm"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/113711323",
              "title": "155cm",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "155cm"
                }
              ]
            },
            {
              "id": "gid://shopify/ProductVariant/236948360",
              "title": "158cm",
              "selectedOptions": [
                {
                  "name": "Title",
                  "value": "158cm"
                }
              ]
            }
          ]
        },
        "options": [
          {
            "id": "gid://shopify/ProductOption/328272167",
            "name": "Title",
            "values": [
              "151cm",
              "155cm",
              "158cm"
            ],
            "position": 1,
            "optionValues": [
              {
                "id": "gid://shopify/ProductOptionValue/141051426",
                "name": "151cm",
                "hasVariants": true
              },
              {
                "id": "gid://shopify/ProductOptionValue/258076414",
                "name": "155cm",
                "hasVariants": true
              },
              {
                "id": "gid://shopify/ProductOptionValue/129596849",
                "name": "158cm",
                "hasVariants": true
              }
            ]
          }
        ]
      }
    }
  }
}