---
title: Add a variant fixed bundle
description: Learn how to add a variant fixed bundle using the GraphQL Admin API.
source_url:
  html: >-
    https://shopify.dev/docs/apps/build/product-merchandising/bundles/add-variant-fixed-bundle
  md: >-
    https://shopify.dev/docs/apps/build/product-merchandising/bundles/add-variant-fixed-bundle.md
api_name: admin
---

# Add a variant fixed bundle

A variant fixed bundle is a bundle that's configured at the variant level. This guide shows you how to add a variant fixed bundle using the [productVariantRelationshipBulkUpdate](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productVariantRelationshipBulkUpdate) mutation.

***

## What you'll learn

In this tutorial, you'll learn how to do the following tasks:

* Use the GraphQL Admin API to create a product with variants
* Associate components to variants
* Delete components in a bundle

***

## Requirements

* You're a [user with app development permissions](https://shopify.dev/docs/apps/build/dev-dashboard/user-permissions).
* You've created a [dev store](https://shopify.dev/docs/apps/build/stores/development-stores#create-a-dev-store). You can create one by running `shopify store create dev`.
* You've [created an app](https://shopify.dev/docs/apps/build/scaffold-app) using Shopify CLI. If you previously installed Shopify CLI, then make sure that you're using the [latest version](https://shopify.dev/docs/api/shopify-cli#upgrade). If you plan to create a UI for your extension, then start with the [React Router app template](https://shopify.dev/docs/api#app-templates).
* You've installed [Node.js](https://nodejs.org/en/download) 16 or higher.
* You've [installed your app](https://shopify.dev/docs/apps/build/scaffold-app#step-4-install-your-app) on the development store.

- Your app can make [authenticated requests](https://shopify.dev/docs/api/admin-graphql#authentication) to the GraphQL Admin API.
- Your app has the `write_products` [access scope](https://shopify.dev/docs/api/usage/access-scopes#write_products). Learn how to [configure your access scopes using Shopify CLI](https://shopify.dev/docs/apps/build/cli-for-apps/app-configuration).

***

## How it works

In a variant fixed bundle, all components are linked to the main variant through the [`productVariantComponents`](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductVariant#connection-productvariant-productvariantcomponents) relationship.

The bundle's price is set by the parent variant, while the bundle’s inventory is determined by the inventory of its component variants. This behavior is the same for [product fixed bundles](https://shopify.dev/docs/apps/build/product-merchandising/bundles/add-product-fixed-bundle).

A product variant has a `productVariantComponents` field that defines its bundle components. Two bundle variants can share the same component variants.

![A diagram showing the relationship between product variants that model a bundle](https://shopify.dev/assets/assets/images/apps/selling-strategies/bundles-diagram-CIPdYEaQ.png)

The following diagram shows an example of a product variant ("The Hair and Skin Bundle") that models a bundle and contains two components: "Natural Shampoo 50 ml" and "Coconut Conditioner". The bundle is modeled by creating a variant, associating the variant with components, and assigning a quantity of one to each component.

![A diagram showing a bundle example with two components](https://shopify.dev/assets/assets/images/apps/selling-strategies/bundles-example-d5cYCymp.png)

***

## Limitations

* A bundle can have up to 30 components.
* Bundles can have up to three options. Combined options are considered one option.
* You can't combine quantity options.
* After an app has assigned components to a bundle, only that app can manage the components of the bundle.
* Nested bundles aren't supported. A bundle can't have components and be part of another bundle simultaneously.

***

## Step 1: Create a product with variants

To create a product with variants, you can run the [`productCreate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productCreate) mutation.

The following example creates a product with a single variant modelling a bundle.

## POST https://{shop}.myshopify.com/api/{api\_version}/graphql.json

## GraphQL query

```graphql
mutation CreateProductBundle($product: ProductCreateInput!) {
  productCreate(product: $product) {
    product {
      title
      variants(first: 10) {
        edges{
          node{
            id
            price
          }
        }
      }
    }
    userErrors{
      field
      message
    }
  }
}
```

## Variables

```json
{
  "product": {
    "title": "The Hair And Skin Bundle"
  }
}
```

## JSON response

```json
{
  "data": {
    "productCreate": {
      "product": {
        "title": "The Hair And Skin Bundle",
        "variants": {
          "edges": [
            {
              "node": {
                "id": "gid://shopify/ProductVariant/PRODUCT-VARIANT-ID",
                "price": "0.00"
              }
            }
          ]
        }
      },
      "userErrors": []
    }
  }
}
```

***

## Step 2: Associate components to variants

After creating the product variant, you need to associate the components of a bundle. To do that, you can run the [`productVariantRelationshipBulkUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productVariantRelationshipBulkUpdate) mutation.

If the variant is associated with components, then the attribute `productVariant.requiresComponents` returns `true`.

The following example associates two components, a Shampoo variant and a Soap variant, with a quantity of one to the product variant created in the [previous step](#step-1-create-a-product-with-variants).

## POST https://{shop}.myshopify.com/api/{api\_version}/graphql.json

## GraphQL query

```graphql
mutation CreateBundleComponents($input: [ProductVariantRelationshipUpdateInput!]!) {
  productVariantRelationshipBulkUpdate(input: $input) {
    parentProductVariants {
      id
      productVariantComponents(first: 10) {
        nodes{
          id
          quantity
          productVariant {
            id
          }
        }
      }
    }
    userErrors {
      code
      field
      message
    }
  }
}
```

## Variables

```json
{
  "input": [{
    "parentProductVariantId": "gid://shopify/ProductVariant/PRODUCT-VARIANT-ID",
    "productVariantRelationshipsToCreate": [
      {
        "id": "gid://shopify/ProductVariant/SHAMPOO-PRODUCT-VARIANT-ID-COMPONENT-1",
        "quantity": 1
      },
      {
        "id": "gid://shopify/ProductVariant/SOAP-PRODUCT-VARIANT-ID-COMPONENT-2",
      "quantity": 1
      }
    ]
  }]
}
```

## JSON response

```json
{
  "data": {
    "productVariantRelationshipBulkUpdate": {
      "parentProductVariants": [
        {
          "id": "gid://shopify/ProductVariant/PRODUCT-VARIANT-ID",
          "productVariantComponents": {
            "nodes": [
              {
                "id": "gid://shopify/ProductVariantComponent/PRODUCT_VARIANT_COMPONENT_1",
                "productVariant": {
                  "id": "gid://shopify/ProductVariant/SHAMPOO-PRODUCT-VARIANT-ID-COMPONENT-1"
                }
              },
              {
                "id": "gid://shopify/ProductVariantComponent/PRODUCT_VARIANT_COMPONENT_2",
                "productVariant": {
                  "id": "gid://shopify/ProductVariant/SOAP-PRODUCT-VARIANT-ID-COMPONENT-2"
                }
              }
            ]
          }
        }
      ],
      "userErrors": []
    }
  }
}
```

**Tip:**

If you need to remove components from a bundle, you can run the [`productVariantRelationshipBulkUpdate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productVariantRelationshipBulkUpdate) mutation with [`productVariantRelationshipsToRemove`](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/ProductVariantRelationshipUpdateInput#field-productvariantrelationshipupdateinput-productvariantrelationshipstoremove) input.

***

## Next steps

* Learn how to use the [`productVariantRelationshipBulkUpdate` mutation](https://shopify.dev/docs/api/admin-graphql/latest/mutations/productVariantRelationshipBulkUpdate).

***
