A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://shopify.dev/docs/api/admin-graphql/latest/mutations/productVariantsBulkCreate below:

productVariantsBulkCreate - GraphQL Admin

Requires write_products access scope. Also: The user must have a permission to create product variants.

Creates multiple product variants for a single product in one operation. You can run this mutation directly or as part of a bulk operation for large-scale catalog updates.

Use the productVariantsBulkCreate mutation to efficiently add new product variants—such as different sizes, colors, or materials—to an existing product. The mutation is helpful if you need to add product variants in bulk, such as importing from an external system.

The mutation supports:

After creating variants, you can make additional changes using one of the following mutations:

You can also specifically manage product options through related mutations:

Learn more about the product model and adding product data.

List of new media to be added to the product.

The ID of the product on which to create the variants.

The strategy defines which behavior the mutation should observe, such as whether to keep or delete the standalone variant (when product has only a single or default variant) when creating new variants in bulk.

An array of product variants to be created.

Was this section helpful?

The updated product object.

The newly created variants.

The list of errors that occurred from executing the mutation.

Was this section helpful?

mutation ProductVariantsCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) { productVariantsBulkCreate(productId: $productId, variants: $variants) { productVariants { id title selectedOptions { name value } } userErrors { field message } } }curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-07/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation ProductVariantsCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) { productVariantsBulkCreate(productId: $productId, variants: $variants) { productVariants { id title selectedOptions { name value } } userErrors { field message } } }", "variables": { "productId": "gid://shopify/Product/20995642", "variants": [ { "price": 15.99, "compareAtPrice": 19.99, "optionValues": [ { "name": "Golden", "optionId": "gid://shopify/ProductOption/328272167" } ] } ] } }'const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation ProductVariantsCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) { productVariantsBulkCreate(productId: $productId, variants: $variants) { productVariants { id title selectedOptions { name value } } userErrors { field message } } }`, { variables: { "productId": "gid://shopify/Product/20995642", "variants": [ { "price": 15.99, "compareAtPrice": 19.99, "optionValues": [ { "name": "Golden", "optionId": "gid://shopify/ProductOption/328272167" } ] } ] }, }, ); const data = await response.json();const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation ProductVariantsCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) { productVariantsBulkCreate(productId: $productId, variants: $variants) { productVariants { id title selectedOptions { name value } } userErrors { field message } } }`, "variables": { "productId": "gid://shopify/Product/20995642", "variants": [ { "price": 15.99, "compareAtPrice": 19.99, "optionValues": [ { "name": "Golden", "optionId": "gid://shopify/ProductOption/328272167" } ] } ] }, }, });session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation ProductVariantsCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) { productVariantsBulkCreate(productId: $productId, variants: $variants) { productVariants { id title selectedOptions { name value } } userErrors { field message } } } QUERY variables = { "productId": "gid://shopify/Product/20995642", "variants": [ { "price": 15.99, "compareAtPrice": 19.99, "optionValues": [ { "name": "Golden", "optionId": "gid://shopify/ProductOption/328272167" } ] } ] } response = client.query(query: query, variables: variables)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4