productSet mutation failing to update products when using linked metafields

I am using productSet mutation to create and update products in Shopify stores. The products use shopify’s linked metafields for product options. I am able to create products with this mutation but when using this mutation to update a product I get this error:

{
“code”: “CAPABILITY_VIOLATION”,
“field”: [
“input”
],
“message”: “This metafield is connected to an option. To make changes, edit the option. Metafield Namespace: shopify, Metafield Key: color-pattern, Metafield Owner: Product”
}

Does productSet mutation not support updating products with linked metafields?

Hey @sagar_tomar! This does look similar to some behavior that’s been reported before with productSet and linked metafields - but I’d want to rule a few things out first.

Could you share the full mutation you’re sending (sanitized is fine), along with the response body and ideally the x-request-id from the response headers? That’ll help me dig into what’s happening on our end.

Also, are you including anything in input.metafields alongside the linked option, or is it just the productOptions with the linked metafield? That distinction matters for this particular error.

Thanks. Was able to figure it out. Needed to provide the linkedMetafield values in the input.metafields as well. This post helped Updating existing product with the `productSet` mutation throws unexpected error, when `input.productOptions` using `linkedMetafield` and `input.metafields` are set at the same time

1 Like