Version: 2024-01
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation CreateBundle($input: [ProductVariantRelationshipUpdateInput!]!) { productVariantRelationshipBulkUpdate(input: $input) { parentProductVariants { id productVariantComponents(first: 10) { nodes { id productVariant { id displayName } } } } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"productVariantRelationshipsToCreate\": [\n {\n \"id\": \"gid://shopify/ProductVariant/149896808\",\n \"quantity\": 1\n },\n {\n \"id\": \"gid://shopify/ProductVariant/709406719\",\n \"quantity\": 1\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 CreateBundle($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"productVariantRelationshipsToCreate\": [\n {\n \"id\": \"gid://shopify/ProductVariant/149896808\",\n \"quantity\": 1\n },\n {\n \"id\": \"gid://shopify/ProductVariant/709406719\",\n \"quantity\": 1\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 CreateBundle($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": [{\"parentProductVariantId\"=>\"gid://shopify/ProductVariant/799757249\", \"productVariantRelationshipsToCreate\"=>[{\"id\"=>\"gid://shopify/ProductVariant/149896808\", \"quantity\"=>1}, {\"id\"=>\"gid://shopify/ProductVariant/709406719\", \"quantity\"=>1}]}]\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 CreateBundle($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [{\"parentProductVariantId\"=>\"gid://shopify/ProductVariant/799757249\", \"productVariantRelationshipsToCreate\"=>[{\"id\"=>\"gid://shopify/ProductVariant/149896808\", \"quantity\"=>1}, {\"id\"=>\"gid://shopify/ProductVariant/709406719\", \"quantity\"=>1}]}],\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 CreateBundle($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"productVariantRelationshipsToCreate\": [\n {\n \"id\": \"gid://shopify/ProductVariant/149896808\",\n \"quantity\": 1\n },\n {\n \"id\": \"gid://shopify/ProductVariant/709406719\",\n \"quantity\": 1\n }\n ]\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation CreateBundle($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "input": [ { "parentProductVariantId": "gid://shopify/ProductVariant/799757249", "productVariantRelationshipsToCreate": [ { "id": "gid://shopify/ProductVariant/149896808", "quantity": 1 }, { "id": "gid://shopify/ProductVariant/709406719", "quantity": 1 } ] } ] }
response: { "data": { "productVariantRelationshipBulkUpdate": { "parentProductVariants": [ { "id": "gid://shopify/ProductVariant/799757249", "productVariantComponents": { "nodes": [ { "id": "gid://shopify/ProductVariantComponent/993184086", "productVariant": { "id": "gid://shopify/ProductVariant/149896808", "displayName": "Composite_Sauce_Pack - component_product_variant_classic_hot_sauce" } }, { "id": "gid://shopify/ProductVariantComponent/993184087", "productVariant": { "id": "gid://shopify/ProductVariant/709406719", "displayName": "Composite_Sauce_Pack - component_product_variant_classic_garlic_sauce" } } ] } } ], "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation RemoveABundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) { productVariantRelationshipBulkUpdate(input: $input) { parentProductVariants { id productVariantComponents(first: 10) { nodes { id productVariant { id displayName } } } } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"productVariantRelationshipsToRemove\": [\n \"gid://shopify/ProductVariant/149896808\"\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 RemoveABundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"productVariantRelationshipsToRemove\": [\n \"gid://shopify/ProductVariant/149896808\"\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 RemoveABundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": [{\"parentProductVariantId\"=>\"gid://shopify/ProductVariant/799757249\", \"productVariantRelationshipsToRemove\"=>[\"gid://shopify/ProductVariant/149896808\"]}]\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 RemoveABundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [{\"parentProductVariantId\"=>\"gid://shopify/ProductVariant/799757249\", \"productVariantRelationshipsToRemove\"=>[\"gid://shopify/ProductVariant/149896808\"]}],\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 RemoveABundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"productVariantRelationshipsToRemove\": [\n \"gid://shopify/ProductVariant/149896808\"\n ]\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation RemoveABundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "input": [ { "parentProductVariantId": "gid://shopify/ProductVariant/799757249", "productVariantRelationshipsToRemove": [ "gid://shopify/ProductVariant/149896808" ] } ] }
response: { "data": { "productVariantRelationshipBulkUpdate": { "parentProductVariants": [ { "id": "gid://shopify/ProductVariant/799757249", "productVariantComponents": { "nodes": [ { "id": "gid://shopify/ProductVariantComponent/636669297", "productVariant": { "id": "gid://shopify/ProductVariant/709406719", "displayName": "Composite_Sauce_Pack - component_product_variant_classic_garlic_sauce" } } ] } } ], "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation RemoveAllBundleComponents($input: [ProductVariantRelationshipUpdateInput!]!) { productVariantRelationshipBulkUpdate(input: $input) { parentProductVariants { id productVariantComponents(first: 10) { nodes { id productVariant { id displayName } } } } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"removeAllProductVariantRelationships\": true\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation RemoveAllBundleComponents($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"removeAllProductVariantRelationships\": true\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 RemoveAllBundleComponents($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": [{\"parentProductVariantId\"=>\"gid://shopify/ProductVariant/799757249\", \"removeAllProductVariantRelationships\"=>true}]\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 RemoveAllBundleComponents($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [{\"parentProductVariantId\"=>\"gid://shopify/ProductVariant/799757249\", \"removeAllProductVariantRelationships\"=>true}],\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 RemoveAllBundleComponents($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"removeAllProductVariantRelationships\": true\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation RemoveAllBundleComponents($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "input": [ { "parentProductVariantId": "gid://shopify/ProductVariant/799757249", "removeAllProductVariantRelationships": true } ] }
response: { "data": { "productVariantRelationshipBulkUpdate": { "parentProductVariants": [ { "id": "gid://shopify/ProductVariant/799757249", "productVariantComponents": { "nodes": [] } } ], "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation UpdateBundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) { productVariantRelationshipBulkUpdate(input: $input) { parentProductVariants { id productVariantComponents(first: 10) { nodes { id productVariant { id displayName } } } } userErrors { code field message } } }\",\n \"variables\": {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"productVariantRelationshipsToUpdate\": [\n {\n \"id\": \"gid://shopify/ProductVariant/149896808\",\n \"quantity\": 33\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 UpdateBundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"productVariantRelationshipsToUpdate\": [\n {\n \"id\": \"gid://shopify/ProductVariant/149896808\",\n \"quantity\": 33\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 UpdateBundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": [{\"parentProductVariantId\"=>\"gid://shopify/ProductVariant/799757249\", \"productVariantRelationshipsToUpdate\"=>[{\"id\"=>\"gid://shopify/ProductVariant/149896808\", \"quantity\"=>33}]}]\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 UpdateBundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [{\"parentProductVariantId\"=>\"gid://shopify/ProductVariant/799757249\", \"productVariantRelationshipsToUpdate\"=>[{\"id\"=>\"gid://shopify/ProductVariant/149896808\", \"quantity\"=>33}]}],\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 UpdateBundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": [\n {\n \"parentProductVariantId\": \"gid://shopify/ProductVariant/799757249\",\n \"productVariantRelationshipsToUpdate\": [\n {\n \"id\": \"gid://shopify/ProductVariant/149896808\",\n \"quantity\": 33\n }\n ]\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation UpdateBundleComponent($input: [ProductVariantRelationshipUpdateInput!]!) {\n productVariantRelationshipBulkUpdate(input: $input) {\n parentProductVariants {\n id\n productVariantComponents(first: 10) {\n nodes {\n id\n productVariant {\n id\n displayName\n }\n }\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n}"
input: { "input": [ { "parentProductVariantId": "gid://shopify/ProductVariant/799757249", "productVariantRelationshipsToUpdate": [ { "id": "gid://shopify/ProductVariant/149896808", "quantity": 33 } ] } ] }
response: { "data": { "productVariantRelationshipBulkUpdate": { "parentProductVariants": [ { "id": "gid://shopify/ProductVariant/799757249", "productVariantComponents": { "nodes": [ { "id": "gid://shopify/ProductVariantComponent/477596995", "productVariant": { "id": "gid://shopify/ProductVariant/149896808", "displayName": "Composite_Sauce_Pack - component_product_variant_classic_hot_sauce" } }, { "id": "gid://shopify/ProductVariantComponent/636669297", "productVariant": { "id": "gid://shopify/ProductVariant/709406719", "displayName": "Composite_Sauce_Pack - component_product_variant_classic_garlic_sauce" } } ] } } ], "userErrors": [] } } }