Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: How do you create a product with the default variant with productSet?

Solved

How do you create a product with the default variant with productSet?

AV_SL
Shopify Partner
40 4 18

I'm trying to create a product with a default variant using productSet, but the below results in an option being defined, rather than the 'hidden' default option for a product with no variants/options.

It appears if you pass in 'Title' and 'Default title' it interprets these as actual options, not as a default option

mutation createProductAsynchronous($productSet: ProductSetInput!, $synchronous: Boolean!) {
  productSet(synchronous: $synchronous, input: $productSet) {
    product {
      id
    }
    productSetOperation {
      id
      status
      userErrors {
        code
        field
        message
      }
    }
    userErrors {
      code
      field
      message
    }
  }
}



{
  "synchronous": false,
  "productSet": {
    "title": "GraphiQL Product 3",
    "status": "ACTIVE",
    "variants": [
      {
        "optionValues": [
          {
            "optionName": "Title",
            "name": "Default title"
          }
        ],
        "price": "9.99",
        "compareAtPrice": "10.99"
      }
    ],
    "productOptions": [
      {
        "name": "Title",
        "values": [
          {
            "name": "Default title"
          }
        ]
      }
    ]
  }
}

 Screenshot 2024-10-19 at 12.08.28 PM.png

Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.
Accepted Solution (1)

AV_SL
Shopify Partner
40 4 18

This is an accepted solution.

PEBCAK solution on this one 😅

The correct value is related to capitalisation - it needs to be "Default Title" not "Default title" - to generate a default variant


Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.

View solution in original post

Reply 1 (1)

AV_SL
Shopify Partner
40 4 18

This is an accepted solution.

PEBCAK solution on this one 😅

The correct value is related to capitalisation - it needs to be "Default Title" not "Default title" - to generate a default variant


Biscuits Bundles App - Create beautiful mix and match bundles using native Shopify bundles functionality.