---
title: "productVariantsBulkCreate"
description: "Bulk create product variants."
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/mutations/product-variants-bulk-create'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/mutations/product-variants-bulk-create.md'
---
# productVariantsBulkCreate

Bulk create product variants. 

- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Mutation

## Type Signature

`ProductVariantsBulkCreatePayload`

## Arguments

* `productId`

  [ID!](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/id.md)

  The product's ID for which the variants will be created. 

* `variants`

  [[ProductVariantsBulkInput!]!](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/inputs/product-variants-bulk-input.md)

  A list of variants that will be created.

## Returns

* `product`

  [Product](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/product.md)

  The revised product object.

* `productVariants`

  [[ProductVariant!]](https://developer.shopline.com/docs/admin-graph-ql-api/products-and-collections/objects/product-variant.md)

  Newly created variant.

* `userErrors`

  [[UserError]!](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/user-error.md)

  List of errors returned during mutation execution.

## Code Example

```graphql
mutation productVariantsBulkCreate($productId: ID! $variants: [ProductVariantsBulkInput!]! ) {
	productVariantsBulkCreate(productId: $productId, variants: $variants ) 
		 {
			# ProductVariantsBulkCreatePayload fields
		}
		
	}

```

## Variables

```json
{
  "productId": {},
  "variants": {
    "barcode": "",
    "compareAtPrice": {},
    "harmonizedSystemCode": {},
    "id": {},
    "inventoryItem": {
      "cost": {},
      "tracked": false
    },
    "inventoryPolicy": {},
    "inventoryQuantities": {
      "availableQuantity": {},
      "locationId": ""
    },
    "mediaId": "",
    "mediaSrc": "",
    "options": "",
    "price": "{}",
    "requiresShipping": {},
    "sku": "",
    "taxable": false,
    "weight": {},
    "weightUnit": {}
  }
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

