Metafields preventing productSet mutation from running when linkedMetafield in productOptions

Metafields preventing productSet mutation from running when linkedMetafield in productOptions

cmcg_lig
Visitor
2 0 1
I'm running into an issue when trying to update a product using "productSet" and the newly supported "linkedMetafield"  field within the "productOptions" input, where the API returns the non-descriptive user error "Something went wrong, please try again". Here are details:


Here is the input with IDs removed:

 

{
    "input": {
        "id": "gid://shopify/Product/{shopify_product_id}",
        "title": "Example Title",
        "category": "gid://shopify/TaxonomyCategory/na",
        "metafields": [
            {
                "key": "style_category",
                "namespace": "custom",
                "value": "Hat",
                "type": "single_line_text_field"
            }
        ],
        "productOptions": [
            {
                "id": "gid://shopify/ProductOption/{product_option_id}",
                "name": "Color",
                "linkedMetafield": {
                    "namespace": "shopify",
                    "key": "color-pattern",
                    "values": [
                        "gid://shopify/Metaobject/{metaobject_id}"
                    ]
                }
            },
            {
                "id": "gid://shopify/ProductOption/{product_option_id}",
                "name": "size",
                "values": [
                    {
                        "name": "TDLR"
                    },
                    {
                        "name": "YUTH"
                    }
                ]
            },
            {
                "id": "gid://shopify/ProductOption/{product_option_id}",
                "name": "Fabric Weight",
                "values": [
                    {
                        "name": "Hat"
                    }
                ]
            }
        ],
        "variants": [
            {
                "id": "gid://shopify/ProductVariant/{product_variant_id}",
                "optionValues": [
                    {
                        "optionName": "Color",
                        "name": "Putty White",
                        "linkedMetafieldValue": "gid://shopify/Metaobject/{metaobject_id}"
                    },
                    {
                        "optionName": "size",
                        "name": "TDLR"
                    },
                    {
                        "optionName": "Fabric Weight",
                        "name": "Hat"
                    }
                ],
                "sku": "80257-TDLR",
                "price": "14.50",
                "compareAtPrice": null,
                "barcode": "12345",
                "metafields": [
                    {
                        "key": "sale_product",
                        "namespace": "custom",
                        "value": "false",
                        "type": "boolean"
                    }
                ]
            },
            {
                "id": "gid://shopify/ProductVariant/{product_variant_id}",
                "optionValues": [
                    {
                        "optionName": "Color",
                        "name": "Putty White",
                        "linkedMetafieldValue": "gid://shopify/Metaobject/{metaobject_id}"
                    },
                    {
                        "optionName": "size",
                        "name": "YUTH"
                    },
                    {
                        "optionName": "Fabric Weight",
                        "name": "Hat"
                    }
                ],
                "sku": "80257-YUTH",
                "price": "14.50",
                "compareAtPrice": null,
                "barcode": "56789",
                "metafields": [
                    {
                        "key": "sale_product",
                        "namespace": "custom",
                        "value": "false",
                        "type": "boolean"
                    }
                ]
            }
        ],
        "status": "DRAFT"
    },
    "synchronous": true
}

 

Replies 2 (2)

qasim_a
Visitor
3 1 0

Try removing the linkedMetafield or simplify the request by reducing the number of productOptions or optionValues. If the update works without linkedMetafield, the issue is likely tied to the metafield handling. Example:

{
  "input": {
    "id": "gid://shopify/Product/{shopify_product_id}",
    "title": "Example Title",
    "productOptions": [
      {
        "id": "gid://shopify/ProductOption/{product_option_id}",
        "name": "Color",
        "values": [
          "Red",
          "Blue"
        ]
      }
    ],
    "variants": [
      {
        "id": "gid://shopify/ProductVariant/{product_variant_id}",
        "optionValues": [
          {
            "optionName": "Color",
            "name": "Red"
          }
        ]
      }
    ]
  }
}

 

 

cmcg_lig
Visitor
2 0 1

Unfortunately that didn't work. It still returns the error "Something went wrong, please try again."