Product csv import not generating variants as mentioned in csv sheet

Topic summary

A developer encountered an issue where bulk CSV imports using GraphQL’s productCreate mutation only generated one variant instead of creating all variants specified in the CSV file, despite properly defining product options.

Problem Context:

  • Using bulk operations to import products via CSV
  • Working within the New Product Model (where /variants endpoint is deprecated)
  • CSV contains multiple option values that should generate corresponding variants
  • Initial productCreate mutation in bulk operation only created a single variant

Solution Found:
After research, the developer discovered that ProductSet Mutation achieves the desired result:

  • Include ProductSet Mutation query within the BulkOperation query
  • Structure inputs according to ProductSetInput specifications
  • The developer provided working example queries showing both the bulk operation wrapper and the nested ProductSet mutation

Status: Resolved - the issue was solved by switching from productCreate to productSet mutation approach. Reference documentation link provided for creating products with variants and options asynchronously.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

I am using bulk operation for importing CSV and creating products using Graphql
Now as suggested in “New Product Model” /variants endpoint is deprecated now
I want to make variants out of the option I have given in CSV

Now this is my bulk operation query :

<<<'QUERY'
            mutation ($bulkMutationKeyUpdate:String!) {
                bulkOperationRunMutation(
                    mutation: "mutation call($input: ProductInput!) { productCreate(input: $input) { product {id title handle options {
                        id
                        name
                        position
                        optionValues {
                          id
                          name
                          hasVariants
                        }
                      }variants(first: 250) {
                        edges {
                          node {
                            id
                            title
                            price
                            sku
                          }
                        }
                      }} userErrors { message field } } }"
                    stagedUploadPath: $bulkMutationKeyUpdate
                ) {
                    bulkOperation {
                        id
                        url
                        status
                    }
                    userErrors {
                        message
                        field
                    }
                }
            }
        QUERY;

But it will only generate 1 variant out of the given option
I want to make variants as i have given in CSV

After doing much R&D I found that we can achieve the same with ProductSet Mutation, we need to include graphql query of ProductSet Mutation to our BulkOperation query and assign inputs according to ProductSetInput

here is an example query for reference:

This is a bulkOperation query:

mutation bulkOperationRunMutation(
                    $mutation: String!
                    $bulkMutationKeyUpdate: String!
                ) {
                    bulkOperationRunMutation(
                        mutation: $mutation
                        stagedUploadPath: $bulkMutationKeyUpdate
                    ) {
                        bulkOperation {
                            id
                            url
                            status
                        }
                        userErrors {
                            message
                            field
                        }
                    }
                }

and this is the ProductSet Mutation query that we are passing to our bulkOperation

mutation productSet($productSet: ProductSetInput!, $synchronous: Boolean!) {
                    productSet(synchronous: $synchronous, input: $productSet) {
                            product {
                                id
                                title
                                handle
                                variants(first: 10) {
                                    nodes {
                                        sku
                                        createdAt
                                        updatedAt
                                    }
                                }
                            }
                            userErrors {
                                code
                                field
                                message
                            }
                        }
                    }

Here if you want to know more information you can refer to this document
https://shopify.dev/docs/api/admin/migrate/new-product-model/sync-data#create-a-product-with-variants-and-options-asynchronously