Add child products to a combined listing
Description
Add new child products to an existing combined listing product.
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
}
}
}
Variables
{
"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"
]
}
]
}
cURL
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"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 } } }",
"variables": {
"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"
]
}
]
}
}'
Remix
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
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
}
}
}`,
{
variables: {
"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"
]
}
]
},
},
);
const data = await response.json();
Ruby
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~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
}
}
}
QUERY
variables = {
"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 = client.query(query: query, variables: variables)
Node.js
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"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
}
}
}`,
"variables": {
"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
{
"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": []
}
}
Add child products with options associated with a metafield to a combined listing
Description
Add new child products with options associated with a metafield to an existing combined listing product.
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
}
}
}
Variables
{
"parentProductId": "gid://shopify/Product/108828309",
"productsAdded": [
{
"childProductId": "gid://shopify/Product/121709582",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Blue",
"linkedMetafieldValue": "gid://shopify/Metaobject/1"
},
{
"name": "Fabric",
"value": "Cotton",
"linkedMetafieldValue": "gid://shopify/Metaobject/3"
}
]
},
{
"childProductId": "gid://shopify/Product/912855135",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Red",
"linkedMetafieldValue": "gid://shopify/Metaobject/2"
},
{
"name": "Fabric",
"value": "Polyester",
"linkedMetafieldValue": "gid://shopify/Metaobject/4"
}
]
}
],
"optionsAndValues": [
{
"name": "Color",
"values": [
"Blue",
"Red"
],
"optionId": "gid://shopify/ProductOption/1",
"linkedMetafield": {
"namespace": "shopify",
"key": "color-pattern",
"values": [
"gid://shopify/Metaobject/1",
"gid://shopify/Metaobject/2"
]
}
},
{
"name": "Fabric",
"values": [
"Cotton",
"Polyester"
],
"optionId": "gid://shopify/ProductOption/2",
"linkedMetafield": {
"namespace": "shopify",
"key": "fabric",
"values": [
"gid://shopify/Metaobject/3",
"gid://shopify/Metaobject/4"
]
}
}
]
}
cURL
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"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 } } }",
"variables": {
"parentProductId": "gid://shopify/Product/108828309",
"productsAdded": [
{
"childProductId": "gid://shopify/Product/121709582",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Blue",
"linkedMetafieldValue": "gid://shopify/Metaobject/1"
},
{
"name": "Fabric",
"value": "Cotton",
"linkedMetafieldValue": "gid://shopify/Metaobject/3"
}
]
},
{
"childProductId": "gid://shopify/Product/912855135",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Red",
"linkedMetafieldValue": "gid://shopify/Metaobject/2"
},
{
"name": "Fabric",
"value": "Polyester",
"linkedMetafieldValue": "gid://shopify/Metaobject/4"
}
]
}
],
"optionsAndValues": [
{
"name": "Color",
"values": [
"Blue",
"Red"
],
"optionId": "gid://shopify/ProductOption/1",
"linkedMetafield": {
"namespace": "shopify",
"key": "color-pattern",
"values": [
"gid://shopify/Metaobject/1",
"gid://shopify/Metaobject/2"
]
}
},
{
"name": "Fabric",
"values": [
"Cotton",
"Polyester"
],
"optionId": "gid://shopify/ProductOption/2",
"linkedMetafield": {
"namespace": "shopify",
"key": "fabric",
"values": [
"gid://shopify/Metaobject/3",
"gid://shopify/Metaobject/4"
]
}
}
]
}
}'
Remix
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
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
}
}
}`,
{
variables: {
"parentProductId": "gid://shopify/Product/108828309",
"productsAdded": [
{
"childProductId": "gid://shopify/Product/121709582",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Blue",
"linkedMetafieldValue": "gid://shopify/Metaobject/1"
},
{
"name": "Fabric",
"value": "Cotton",
"linkedMetafieldValue": "gid://shopify/Metaobject/3"
}
]
},
{
"childProductId": "gid://shopify/Product/912855135",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Red",
"linkedMetafieldValue": "gid://shopify/Metaobject/2"
},
{
"name": "Fabric",
"value": "Polyester",
"linkedMetafieldValue": "gid://shopify/Metaobject/4"
}
]
}
],
"optionsAndValues": [
{
"name": "Color",
"values": [
"Blue",
"Red"
],
"optionId": "gid://shopify/ProductOption/1",
"linkedMetafield": {
"namespace": "shopify",
"key": "color-pattern",
"values": [
"gid://shopify/Metaobject/1",
"gid://shopify/Metaobject/2"
]
}
},
{
"name": "Fabric",
"values": [
"Cotton",
"Polyester"
],
"optionId": "gid://shopify/ProductOption/2",
"linkedMetafield": {
"namespace": "shopify",
"key": "fabric",
"values": [
"gid://shopify/Metaobject/3",
"gid://shopify/Metaobject/4"
]
}
}
]
},
},
);
const data = await response.json();
Ruby
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~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
}
}
}
QUERY
variables = {
"parentProductId": "gid://shopify/Product/108828309",
"productsAdded": [
{
"childProductId": "gid://shopify/Product/121709582",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Blue",
"linkedMetafieldValue": "gid://shopify/Metaobject/1"
},
{
"name": "Fabric",
"value": "Cotton",
"linkedMetafieldValue": "gid://shopify/Metaobject/3"
}
]
},
{
"childProductId": "gid://shopify/Product/912855135",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Red",
"linkedMetafieldValue": "gid://shopify/Metaobject/2"
},
{
"name": "Fabric",
"value": "Polyester",
"linkedMetafieldValue": "gid://shopify/Metaobject/4"
}
]
}
],
"optionsAndValues": [
{
"name": "Color",
"values": [
"Blue",
"Red"
],
"optionId": "gid://shopify/ProductOption/1",
"linkedMetafield": {
"namespace": "shopify",
"key": "color-pattern",
"values": [
"gid://shopify/Metaobject/1",
"gid://shopify/Metaobject/2"
]
}
},
{
"name": "Fabric",
"values": [
"Cotton",
"Polyester"
],
"optionId": "gid://shopify/ProductOption/2",
"linkedMetafield": {
"namespace": "shopify",
"key": "fabric",
"values": [
"gid://shopify/Metaobject/3",
"gid://shopify/Metaobject/4"
]
}
}
]
}
response = client.query(query: query, variables: variables)
Node.js
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"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
}
}
}`,
"variables": {
"parentProductId": "gid://shopify/Product/108828309",
"productsAdded": [
{
"childProductId": "gid://shopify/Product/121709582",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Blue",
"linkedMetafieldValue": "gid://shopify/Metaobject/1"
},
{
"name": "Fabric",
"value": "Cotton",
"linkedMetafieldValue": "gid://shopify/Metaobject/3"
}
]
},
{
"childProductId": "gid://shopify/Product/912855135",
"selectedParentOptionValues": [
{
"name": "Color",
"value": "Red",
"linkedMetafieldValue": "gid://shopify/Metaobject/2"
},
{
"name": "Fabric",
"value": "Polyester",
"linkedMetafieldValue": "gid://shopify/Metaobject/4"
}
]
}
],
"optionsAndValues": [
{
"name": "Color",
"values": [
"Blue",
"Red"
],
"optionId": "gid://shopify/ProductOption/1",
"linkedMetafield": {
"namespace": "shopify",
"key": "color-pattern",
"values": [
"gid://shopify/Metaobject/1",
"gid://shopify/Metaobject/2"
]
}
},
{
"name": "Fabric",
"values": [
"Cotton",
"Polyester"
],
"optionId": "gid://shopify/ProductOption/2",
"linkedMetafield": {
"namespace": "shopify",
"key": "fabric",
"values": [
"gid://shopify/Metaobject/3",
"gid://shopify/Metaobject/4"
]
}
}
]
},
},
});
Response
{
"combinedListingUpdate": {
"product": {
"id": "gid://shopify/Product/108828309",
"combinedListing": {
"combinedListingChildren": {
"nodes": [
{
"product": {
"id": "gid://shopify/Product/121709582"
},
"parentVariant": {
"selectedOptions": [
{
"name": "Color",
"value": "Blue",
"optionValue": {
"linkedMetafieldValue": "gid://shopify/Metaobject/1"
}
},
{
"name": "Fabric",
"value": "Cotton",
"optionValue": {
"linkedMetafieldValue": "gid://shopify/Metaobject/3"
}
}
]
}
},
{
"product": {
"id": "gid://shopify/Product/912855135"
},
"parentVariant": {
"selectedOptions": [
{
"name": "Color",
"value": "Red",
"optionValue": {
"linkedMetafieldValue": "gid://shopify/Metaobject/2"
}
},
{
"name": "Fabric",
"value": "Polyester",
"optionValue": {
"linkedMetafieldValue": "gid://shopify/Metaobject/4"
}
}
]
}
}
]
}
}
},
"userErrors": []
}
}
Remove child products from a combined listing
Description
Remove child products from an existing combined listing product.
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
}
}
}
Variables
{
"parentProductId": "gid://shopify/Product/362339553",
"productsRemovedIds": [
"gid://shopify/Product/223392616"
]
}
cURL
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"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 } } }",
"variables": {
"parentProductId": "gid://shopify/Product/362339553",
"productsRemovedIds": [
"gid://shopify/Product/223392616"
]
}
}'
Remix
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation RemoveChildProductsFromCombinedListing($parentProductId: ID!, $productsRemovedIds: [ID!]) {
combinedListingUpdate(parentProductId: $parentProductId, productsRemovedIds: $productsRemovedIds) {
product {
id
combinedListing {
combinedListingChildren(first: 10) {
nodes {
product {
id
}
}
}
}
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"parentProductId": "gid://shopify/Product/362339553",
"productsRemovedIds": [
"gid://shopify/Product/223392616"
]
},
},
);
const data = await response.json();
Ruby
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~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
}
}
}
QUERY
variables = {
"parentProductId": "gid://shopify/Product/362339553",
"productsRemovedIds": [
"gid://shopify/Product/223392616"
]
}
response = client.query(query: query, variables: variables)
Node.js
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"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
}
}
}`,
"variables": {
"parentProductId": "gid://shopify/Product/362339553",
"productsRemovedIds": [
"gid://shopify/Product/223392616"
]
},
},
});
Response
{
"combinedListingUpdate": {
"product": {
"id": "gid://shopify/Product/362339553",
"combinedListing": {
"combinedListingChildren": {
"nodes": [
{
"product": {
"id": "gid://shopify/Product/555575834"
}
}
]
}
}
},
"userErrors": []
}
}
Update option values of combined listing child product
Description
Update child products of an existing combined listing product.
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
}
}
}
Variables
{
"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"
}
]
}
]
}
cURL
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"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 } } }",
"variables": {
"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"
}
]
}
]
}
}'
Remix
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
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
}
}
}`,
{
variables: {
"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"
}
]
}
]
},
},
);
const data = await response.json();
Ruby
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~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
}
}
}
QUERY
variables = {
"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 = client.query(query: query, variables: variables)
Node.js
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"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
}
}
}`,
"variables": {
"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
{
"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": []
}
}