Version: 2024-07
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AddChildProductsToCombinedListing($parentProductId: ID!, $productsAdded: [ChildProductRelationInput!], $optionsAndValues: [OptionAndValueInput!]) { combinedListingUpdate(parentProductId: $parentProductId, productsAdded: $productsAdded, optionsAndValues: $optionsAndValues) { product { id combinedListing { combinedListingChildren(first: 10) { nodes { product { id } parentVariant { selectedOptions { value } } } } } } userErrors { code field message } } }\",\n \"variables\": {\n \"parentProductId\": \"gid://shopify/Product/108828309\",\n \"productsAdded\": [\n {\n \"childProductId\": \"gid://shopify/Product/121709582\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"color\",\n \"value\": \"Blue\"\n },\n {\n \"name\": \"size\",\n \"value\": \"12\"\n }\n ]\n },\n {\n \"childProductId\": \"gid://shopify/Product/912855135\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"color\",\n \"value\": \"Red\"\n },\n {\n \"name\": \"size\",\n \"value\": \"12\"\n }\n ]\n }\n ],\n \"optionsAndValues\": [\n {\n \"name\": \"color\",\n \"values\": [\n \"Blue\",\n \"Red\"\n ]\n },\n {\n \"name\": \"size\",\n \"values\": [\n \"12\"\n ]\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation AddChildProductsToCombinedListing($parentProductId: ID!, $productsAdded: [ChildProductRelationInput!], $optionsAndValues: [OptionAndValueInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsAdded: $productsAdded, optionsAndValues: $optionsAndValues) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"parentProductId\": \"gid://shopify/Product/108828309\",\n \"productsAdded\": [\n {\n \"childProductId\": \"gid://shopify/Product/121709582\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"color\",\n \"value\": \"Blue\"\n },\n {\n \"name\": \"size\",\n \"value\": \"12\"\n }\n ]\n },\n {\n \"childProductId\": \"gid://shopify/Product/912855135\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"color\",\n \"value\": \"Red\"\n },\n {\n \"name\": \"size\",\n \"value\": \"12\"\n }\n ]\n }\n ],\n \"optionsAndValues\": [\n {\n \"name\": \"color\",\n \"values\": [\n \"Blue\",\n \"Red\"\n ]\n },\n {\n \"name\": \"size\",\n \"values\": [\n \"12\"\n ]\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation AddChildProductsToCombinedListing($parentProductId: ID!, $productsAdded: [ChildProductRelationInput!], $optionsAndValues: [OptionAndValueInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsAdded: $productsAdded, optionsAndValues: $optionsAndValues) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"parentProductId\": \"gid://shopify/Product/108828309\",\n \"productsAdded\": [{\"childProductId\"=>\"gid://shopify/Product/121709582\", \"selectedParentOptionValues\"=>[{\"name\"=>\"color\", \"value\"=>\"Blue\"}, {\"name\"=>\"size\", \"value\"=>\"12\"}]}, {\"childProductId\"=>\"gid://shopify/Product/912855135\", \"selectedParentOptionValues\"=>[{\"name\"=>\"color\", \"value\"=>\"Red\"}, {\"name\"=>\"size\", \"value\"=>\"12\"}]}],\n \"optionsAndValues\": [{\"name\"=>\"color\", \"values\"=>[\"Blue\", \"Red\"]}, {\"name\"=>\"size\", \"values\"=>[\"12\"]}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation AddChildProductsToCombinedListing($parentProductId: ID!, $productsAdded: [ChildProductRelationInput!], $optionsAndValues: [OptionAndValueInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsAdded: $productsAdded, optionsAndValues: $optionsAndValues) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"parentProductId\" => \"gid://shopify/Product/108828309\",\n \"productsAdded\" => [{\"childProductId\"=>\"gid://shopify/Product/121709582\", \"selectedParentOptionValues\"=>[{\"name\"=>\"color\", \"value\"=>\"Blue\"}, {\"name\"=>\"size\", \"value\"=>\"12\"}]}, {\"childProductId\"=>\"gid://shopify/Product/912855135\", \"selectedParentOptionValues\"=>[{\"name\"=>\"color\", \"value\"=>\"Red\"}, {\"name\"=>\"size\", \"value\"=>\"12\"}]}],\n \"optionsAndValues\" => [{\"name\"=>\"color\", \"values\"=>[\"Blue\", \"Red\"]}, {\"name\"=>\"size\", \"values\"=>[\"12\"]}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation AddChildProductsToCombinedListing($parentProductId: ID!, $productsAdded: [ChildProductRelationInput!], $optionsAndValues: [OptionAndValueInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsAdded: $productsAdded, optionsAndValues: $optionsAndValues) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"parentProductId\": \"gid://shopify/Product/108828309\",\n \"productsAdded\": [\n {\n \"childProductId\": \"gid://shopify/Product/121709582\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"color\",\n \"value\": \"Blue\"\n },\n {\n \"name\": \"size\",\n \"value\": \"12\"\n }\n ]\n },\n {\n \"childProductId\": \"gid://shopify/Product/912855135\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"color\",\n \"value\": \"Red\"\n },\n {\n \"name\": \"size\",\n \"value\": \"12\"\n }\n ]\n }\n ],\n \"optionsAndValues\": [\n {\n \"name\": \"color\",\n \"values\": [\n \"Blue\",\n \"Red\"\n ]\n },\n {\n \"name\": \"size\",\n \"values\": [\n \"12\"\n ]\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation AddChildProductsToCombinedListing($parentProductId: ID!, $productsAdded: [ChildProductRelationInput!], $optionsAndValues: [OptionAndValueInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsAdded: $productsAdded, optionsAndValues: $optionsAndValues) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "parentProductId": "gid://shopify/Product/108828309", "productsAdded": [ { "childProductId": "gid://shopify/Product/121709582", "selectedParentOptionValues": [ { "name": "color", "value": "Blue" }, { "name": "size", "value": "12" } ] }, { "childProductId": "gid://shopify/Product/912855135", "selectedParentOptionValues": [ { "name": "color", "value": "Red" }, { "name": "size", "value": "12" } ] } ], "optionsAndValues": [ { "name": "color", "values": [ "Blue", "Red" ] }, { "name": "size", "values": [ "12" ] } ] }
response: { "data": { "combinedListingUpdate": { "product": { "id": "gid://shopify/Product/108828309", "combinedListing": { "combinedListingChildren": { "nodes": [ { "product": { "id": "gid://shopify/Product/121709582" }, "parentVariant": { "selectedOptions": [ { "value": "Blue" }, { "value": "12" } ] } }, { "product": { "id": "gid://shopify/Product/912855135" }, "parentVariant": { "selectedOptions": [ { "value": "Red" }, { "value": "12" } ] } } ] } } }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation RemoveChildProductsFromCombinedListing($parentProductId: ID!, $productsRemovedIds: [ID!]) { combinedListingUpdate(parentProductId: $parentProductId, productsRemovedIds: $productsRemovedIds) { product { id combinedListing { combinedListingChildren(first: 10) { nodes { product { id } } } } } userErrors { code field message } } }\",\n \"variables\": {\n \"parentProductId\": \"gid://shopify/Product/362339553\",\n \"productsRemovedIds\": [\n \"gid://shopify/Product/223392616\"\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation RemoveChildProductsFromCombinedListing($parentProductId: ID!, $productsRemovedIds: [ID!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsRemovedIds: $productsRemovedIds) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"parentProductId\": \"gid://shopify/Product/362339553\",\n \"productsRemovedIds\": [\n \"gid://shopify/Product/223392616\"\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation RemoveChildProductsFromCombinedListing($parentProductId: ID!, $productsRemovedIds: [ID!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsRemovedIds: $productsRemovedIds) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"parentProductId\": \"gid://shopify/Product/362339553\",\n \"productsRemovedIds\": [\"gid://shopify/Product/223392616\"]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation RemoveChildProductsFromCombinedListing($parentProductId: ID!, $productsRemovedIds: [ID!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsRemovedIds: $productsRemovedIds) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"parentProductId\" => \"gid://shopify/Product/362339553\",\n \"productsRemovedIds\" => [\"gid://shopify/Product/223392616\"],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation RemoveChildProductsFromCombinedListing($parentProductId: ID!, $productsRemovedIds: [ID!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsRemovedIds: $productsRemovedIds) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"parentProductId\": \"gid://shopify/Product/362339553\",\n \"productsRemovedIds\": [\n \"gid://shopify/Product/223392616\"\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation RemoveChildProductsFromCombinedListing($parentProductId: ID!, $productsRemovedIds: [ID!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsRemovedIds: $productsRemovedIds) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "parentProductId": "gid://shopify/Product/362339553", "productsRemovedIds": [ "gid://shopify/Product/223392616" ] }
response: { "data": { "combinedListingUpdate": { "product": { "id": "gid://shopify/Product/362339553", "combinedListing": { "combinedListingChildren": { "nodes": [ { "product": { "id": "gid://shopify/Product/555575834" } } ] } } }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation UpdateChildProductsOfCombinedListing($parentProductId: ID!, $productsEdited: [ChildProductRelationInput!]) { combinedListingUpdate(parentProductId: $parentProductId, productsEdited: $productsEdited) { product { id combinedListing { combinedListingChildren(first: 10) { nodes { product { id } parentVariant { selectedOptions { value } } } } } } userErrors { code field message } } }\",\n \"variables\": {\n \"parentProductId\": \"gid://shopify/Product/362339553\",\n \"productsEdited\": [\n {\n \"childProductId\": \"gid://shopify/Product/223392616\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"Color\",\n \"value\": \"green\"\n }\n ]\n },\n {\n \"childProductId\": \"gid://shopify/Product/555575834\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"Color\",\n \"value\": \"blue\"\n }\n ]\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation UpdateChildProductsOfCombinedListing($parentProductId: ID!, $productsEdited: [ChildProductRelationInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsEdited: $productsEdited) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"parentProductId\": \"gid://shopify/Product/362339553\",\n \"productsEdited\": [\n {\n \"childProductId\": \"gid://shopify/Product/223392616\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"Color\",\n \"value\": \"green\"\n }\n ]\n },\n {\n \"childProductId\": \"gid://shopify/Product/555575834\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"Color\",\n \"value\": \"blue\"\n }\n ]\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation UpdateChildProductsOfCombinedListing($parentProductId: ID!, $productsEdited: [ChildProductRelationInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsEdited: $productsEdited) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"parentProductId\": \"gid://shopify/Product/362339553\",\n \"productsEdited\": [{\"childProductId\"=>\"gid://shopify/Product/223392616\", \"selectedParentOptionValues\"=>[{\"name\"=>\"Color\", \"value\"=>\"green\"}]}, {\"childProductId\"=>\"gid://shopify/Product/555575834\", \"selectedParentOptionValues\"=>[{\"name\"=>\"Color\", \"value\"=>\"blue\"}]}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation UpdateChildProductsOfCombinedListing($parentProductId: ID!, $productsEdited: [ChildProductRelationInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsEdited: $productsEdited) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"parentProductId\" => \"gid://shopify/Product/362339553\",\n \"productsEdited\" => [{\"childProductId\"=>\"gid://shopify/Product/223392616\", \"selectedParentOptionValues\"=>[{\"name\"=>\"Color\", \"value\"=>\"green\"}]}, {\"childProductId\"=>\"gid://shopify/Product/555575834\", \"selectedParentOptionValues\"=>[{\"name\"=>\"Color\", \"value\"=>\"blue\"}]}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation UpdateChildProductsOfCombinedListing($parentProductId: ID!, $productsEdited: [ChildProductRelationInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsEdited: $productsEdited) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"parentProductId\": \"gid://shopify/Product/362339553\",\n \"productsEdited\": [\n {\n \"childProductId\": \"gid://shopify/Product/223392616\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"Color\",\n \"value\": \"green\"\n }\n ]\n },\n {\n \"childProductId\": \"gid://shopify/Product/555575834\",\n \"selectedParentOptionValues\": [\n {\n \"name\": \"Color\",\n \"value\": \"blue\"\n }\n ]\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation UpdateChildProductsOfCombinedListing($parentProductId: ID!, $productsEdited: [ChildProductRelationInput!]) {\n combinedListingUpdate(parentProductId: $parentProductId, productsEdited: $productsEdited) {\n product {\n id\n combinedListing {\n combinedListingChildren(first: 10) {\n nodes {\n product {\n id\n }\n parentVariant {\n selectedOptions {\n value\n }\n }\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "parentProductId": "gid://shopify/Product/362339553", "productsEdited": [ { "childProductId": "gid://shopify/Product/223392616", "selectedParentOptionValues": [ { "name": "Color", "value": "green" } ] }, { "childProductId": "gid://shopify/Product/555575834", "selectedParentOptionValues": [ { "name": "Color", "value": "blue" } ] } ] }
response: { "data": { "combinedListingUpdate": { "product": { "id": "gid://shopify/Product/362339553", "combinedListing": { "combinedListingChildren": { "nodes": [ { "product": { "id": "gid://shopify/Product/555575834" }, "parentVariant": { "selectedOptions": [ { "value": "blue" } ] } }, { "product": { "id": "gid://shopify/Product/223392616" }, "parentVariant": { "selectedOptions": [ { "value": "green" } ] } } ] } } }, "userErrors": [] } } }