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.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Error bulk mutation product update

Error bulk mutation product update

antonioreale
Shopify Partner
19 1 3

Hello, I am getting an error with product update bulk mutation:

here the json example of one line:

{"input": {"descriptionHtml": "Se sei alla ricerca di novità alla moda sul mercato, ti presentiamo <b>Vino Rosato Ramon Canals Marta Passió Reserva (75 cl)</b>!<br><ul><li>Classificazione: Reserva</li><li>Formato: 75 cl</li><li>Varietà di uva: <ul><li>Macabeo</li><li>Parellada</li><li>Garnacha</li><li>Xarel-lo</li></ul></li></ul>", "metafields": [{"id": "gid://shopify/Metafield/25599317639396", "key": "shipping_time", "namespace": "shipping", "type": "single_line_text_field", "value": "Spedizione in 2-6 giorni lavorativi"}], "productType": "Vino Rosato Ramon Canals 8429617023509 Reserva (75 cl)", "published": true, "status": "ACTIVE", "tags": ["__BIGBUY__", "Marca_Ramon Canals", "Cucina Gourmet", "Enologia", "category-reference-2403", "category-reference-2487", "__BIGBUY__2403", "__BIGBUY__2487"], "title": "Vino Rosato Ramon Canals 8429617023509 Reserva (75 cl)", "variants": [{"mediaSrc": ["https://image"], "barcode": "8429617023509", "compareAtPrice": 25.96, "inventoryItem": {"cost": 12.94, "tracked": true}, "inventoryPolicy": "DENY", "inventoryQuantities": {"availableQuantity": 0, "locationId": "gid://shopify/Location/xxxxxxxxx"}, "price": 20.76, "requiresShipping": true, "sku": "S0586604", "taxable": true, "weight": 1.621, "weightUnit": "KILOGRAMS"}], "vendor": "Ramon Canals", "id": "gid://shopify/Product/xxxxxx"}}

This is the graphql mutation:

    mutation productUpdate($input: ProductInput!, $media: [CreateMediaInput!]) {
        productUpdate(input: $input, media: $media) {
            product {
                id
            }
            userErrors {
                message
                field
            }
        }
    }

This is the error line:

{"data":{"productUpdate":{"userErrors":[{"message":"Variable $input of type ProductInput! was provided invalid value","field":["query"],"type":"GraphApi::BulkMutationUserError","code":null,"extra_info":null}]}},"__lineNumber":9}

What is the problem?

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 239 535

Hey @antonioreale , thanks for sharing the full mutation and example error. 

 

Testing a similar query on my end works just fine. 

 

The error tells us that the issue is with your metafield type variable. 

 

The first step in troubleshooting here, I would look in to your metafield definition for "shipping" to ensure that this is a supported type for that definition. 

 

If that doesn't help, share some more information around how the metafields are configured so we can replicate on our end further. 

 

Hope that helps, 

 

- Kyle G.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog