Anyone know how to use the ProductVariantsBulkInput

Todd_Trimakas
Shopify Partner
119 0 21

All I'm doing is copying the example from here and putting it into the Graphql app I have installed on my dev store. And of course it does not work. Here is the code itself:

 

mutation productVariantsBulkUpdate($variants: [ProductVariantsBulkInput!]!, $productId: ID!) {
  productVariantsBulkUpdate(variants: $variants, productId: $productId) {
    product {
      cursor
    }
    productVariants {
      cursor
    }
    userErrors {
      code
      field
      message
    }
  }
}

 

And then my variables:

{
  "variants": [
    {
      id:  "gid://shopify/ProductVariant/39369514385591",
      price: "50.00"
    }
  ],
  "productId": "gid://shopify/Product/6591908577463"
}

 

Any idea why this isn't working?

ByteStand - Amazon to Shopify in one click
ElRuberino
Tourist
6 0 4

You've probably moved on by now, but for anyone else finding this...

 

The problem for me was the `mediaSrc` was set to `null` and that was causing an error - either omit it or set it to an empty array, and that should sort it.

 

Not sure if anyone from Shopify picks these things up, or if there's anywhere for us to submit bug reports, but this has absolutely consumed me for the past few days. A descriptive error message would be really helpful, as in the end I had to just delete each field line by line to see if it would make a difference. (Got there in the end)

0 Likes