All things Shopify and commerce
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
}
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"
}
]
}
]
}
}
Unfortunately that didn't work. It still returns the error "Something went wrong, please try again."
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024