ProductUpdateInput isn't a defined input type

I used to this mutation below ( ver 2024-10 - latest ) to update status of product because
Shopify warning : As of 2024-10 version of the Admin GraphQL API, the ProductInput object has been split into ProductCreateInput and ProductUpdateInput. The productCreate and productUpdate mutations now accept a new product argument using these types.

My code :

mutation UpdateProductWithNewMedia($input: ProductUpdateInput!, $media: [CreateMediaInput!]) {
      productUpdate(input: $input, media: $media) {
        product {
          id
          status
          media(first: 10) {
            nodes {
              alt
              mediaContentType
              preview {
                status
              }
            }
          }
        }
        userErrors {
          field
          message
        }
      }
    }

but an error occur :
ProductUpdateInput isn’t a defined input type .
Someone help me, thanks !!

Hi @DinhDuyThanh , according to this page, it should be “ProductInput!”, not “ProductUpdateInput!”.

but in Shopify docs, they said :

As of 2024-10 version of the Admin GraphQL API, the ProductInput object has been split into ProductCreateInput and ProductUpdateInput. The productCreate and productUpdate mutations now accept a new product argument using these types.

The existing input field has been marked deprecated.

@DinhDuyThanh , you’re right. I was testing locally with GraphiQL and that worked for me, but I see now that it also works with ProductUpdateInput. How are you executing your GraphQL query? With an app? If so, have you made sure you’re actually using 2024-10?

How do you use it?
Can you give show me your query which using ProductUpdateInput . Thanks

This is my query

mutation UpdateProductWithNewMedia($product: ProductUpdateInput!, $media: [CreateMediaInput!]) {
        productUpdate(product: $input, media: $media) {
          product {
            id
            status
            media(first: 10) {
              nodes {
                alt
                mediaContentType
                preview {
                  status
                }
              }
            }
          }
          userErrors {
            field
            message
          }
        }
      }

Still error GraphqlQueryError: ProductUpdateInput isn’t a defined input type (on $product)

Local GraphiQL using Shopify CLI (using example from docs and with 2024-10 selected):

mutation UpdateProductWithNewMedia($input: ProductUpdateInput!, $media: [CreateMediaInput!]) {
  productUpdate(product: $input, media: $media) {
    product {
      id
      media(first: 10) {
        nodes {
          alt
          mediaContentType
          preview {
            status
          }
        }
      }
    }
    userErrors {
      field
      message
    }
  }
}

Variables:

{
  "input": {
    "id": "gid://shopify/Product/912855135"
  },
  "media": [
    {
      "originalSource": "https://cdn.shopify.com/shopifycloud/brochure/assets/sell/image/image-@artdirection-large-1ba8d5de56c361cec6bc487b747c8774b9ec8203f392a99f53c028df8d0fb3fc.png",
      "alt": "Gray helmet for bikers",
      "mediaContentType": "IMAGE"
    },
    {
      "originalSource": "https://www.youtube.com/watch?v=4L8VbGRibj8&list=PLlMkWQ65HlcEoPyG9QayqEaAu0ftj0MMz",
      "alt": "Testing helmet resistance against impacts",
      "mediaContentType": "EXTERNAL_VIDEO"
    }
  ]
}

I copied this but it doesn’t work for me, I don’t know why .
I’m using latest version:

@Shopify_77 /shopify-api": “11.5.0”,
Error still occur : ProductUpdateInput isn’t a defined input type .

Finally, I resolved it , Thank you a lot :hugs:

1 Like

Hello,
I hope you’re doing well.
I’m currently facing the same issue that you encountered. Could you please share how you were able to resolve it in the end?
Thank you!