selling Plan Group Updatemutation
mutation
2024-10latest
Requires write
access scope as well as any of write
, write
access scopes. Also: The user must have manage
permissions.
Update a Selling Plan Group.
Arguments
The Selling Plan Group to update.
The properties of the Selling Plan Group to update.
Was this section helpful?
SellingPlanGroupUpdatePayload returns
Anchor to SellingPlanGroupUpdatePayload.deletedSellingPlanIdsdeletedSelling Plan Ids The IDs of the deleted Subscription Plans.
The updated Selling Plan Group.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: sellingPlanGroupUpdate
Query Reference for MUTATION: sellingPlanGroupUpdate
"mutation sellingPlanGroupUpdate($id: ID!, $input: SellingPlanGroupInput!) {\n sellingPlanGroupUpdate(id: $id, input: $input) {\n deletedSellingPlanIds\n sellingPlanGroup {\n # SellingPlanGroup fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: sellingPlanGroupUpdate
"{\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"input\": {\n \"appId\": \"<your-appId>\",\n \"description\": \"<your-description>\",\n \"merchantCode\": \"<your-merchantCode>\",\n \"name\": \"<your-name>\",\n \"options\": [\n \"<your-options>\"\n ],\n \"position\": 1,\n \"sellingPlansToCreate\": [\n {\n \"billingPolicy\": {\n \"fixed\": {\n \"checkoutCharge\": {\n \"type\": \"PERCENTAGE\",\n \"value\": {\n \"fixedValue\": \"29.99\",\n \"percentage\": 1.1\n }\n },\n \"remainingBalanceChargeExactTime\": \"2019-09-07T15:50:00Z\",\n \"remainingBalanceChargeTimeAfterCheckout\": \"<your-remainingBalanceChargeTimeAfterCheckout>\",\n \"remainingBalanceChargeTrigger\": \"EXACT_TIME\"\n },\n \"recurring\": {\n \"anchors\": [\n {\n \"cutoffDay\": 1,\n \"day\": 1,\n \"month\": 1,\n \"type\": \"MONTHDAY\"\n }\n ],\n \"interval\": \"DAY\",\n \"intervalCount\": 1,\n \"maxCycles\": 1,\n \"minCycles\": 1\n }\n },\n \"category\": \"OTHER\",\n \"deliveryPolicy\": {\n \"fixed\": {\n \"anchors\": [\n {\n \"cutoffDay\": 1,\n \"day\": 1,\n \"month\": 1,\n \"type\": \"MONTHDAY\"\n }\n ],\n \"cutoff\": 1,\n \"fulfillmentExactTime\": \"2019-09-07T15:50:00Z\",\n \"fulfillmentTrigger\": \"ANCHOR\",\n \"intent\": \"FULFILLMENT_BEGIN\",\n \"preAnchorBehavior\": \"ASAP\"\n },\n \"recurring\": {\n \"anchors\": [\n {\n \"cutoffDay\": 1,\n \"day\": 1,\n \"month\": 1,\n \"type\": \"MONTHDAY\"\n }\n ],\n \"cutoff\": 1,\n \"intent\": \"FULFILLMENT_BEGIN\",\n \"interval\": \"DAY\",\n \"intervalCount\": 1,\n \"preAnchorBehavior\": \"ASAP\"\n }\n },\n \"description\": \"<your-description>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"inventoryPolicy\": {\n \"reserve\": \"ON_FULFILLMENT\"\n },\n \"metafields\": [\n {\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"key\": \"<your-key>\",\n \"namespace\": \"<your-namespace>\",\n \"type\": \"<your-type>\",\n \"value\": \"<your-value>\"\n }\n ],\n \"name\": \"<your-name>\",\n \"options\": [\n \"<your-options>\"\n ],\n \"position\": 1,\n \"pricingPolicies\": [\n {\n \"fixed\": {\n \"adjustmentType\": \"FIXED_AMOUNT\",\n \"adjustmentValue\": {\n \"fixedValue\": \"29.99\",\n \"percentage\": 1.1\n },\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n },\n \"recurring\": {\n \"adjustmentType\": \"FIXED_AMOUNT\",\n \"adjustmentValue\": {\n \"fixedValue\": \"29.99\",\n \"percentage\": 1.1\n },\n \"afterCycle\": 1,\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n }\n }\n ]\n }\n ],\n \"sellingPlansToDelete\": [\n \"gid://shopify/<objectName>/10079785100\"\n ],\n \"sellingPlansToUpdate\": [\n {\n \"billingPolicy\": {\n \"fixed\": {\n \"checkoutCharge\": {\n \"type\": \"PERCENTAGE\",\n \"value\": {\n \"fixedValue\": \"29.99\",\n \"percentage\": 1.1\n }\n },\n \"remainingBalanceChargeExactTime\": \"2019-09-07T15:50:00Z\",\n \"remainingBalanceChargeTimeAfterCheckout\": \"<your-remainingBalanceChargeTimeAfterCheckout>\",\n \"remainingBalanceChargeTrigger\": \"EXACT_TIME\"\n },\n \"recurring\": {\n \"anchors\": [\n {\n \"cutoffDay\": 1,\n \"day\": 1,\n \"month\": 1,\n \"type\": \"MONTHDAY\"\n }\n ],\n \"interval\": \"DAY\",\n \"intervalCount\": 1,\n \"maxCycles\": 1,\n \"minCycles\": 1\n }\n },\n \"category\": \"OTHER\",\n \"deliveryPolicy\": {\n \"fixed\": {\n \"anchors\": [\n {\n \"cutoffDay\": 1,\n \"day\": 1,\n \"month\": 1,\n \"type\": \"MONTHDAY\"\n }\n ],\n \"cutoff\": 1,\n \"fulfillmentExactTime\": \"2019-09-07T15:50:00Z\",\n \"fulfillmentTrigger\": \"ANCHOR\",\n \"intent\": \"FULFILLMENT_BEGIN\",\n \"preAnchorBehavior\": \"ASAP\"\n },\n \"recurring\": {\n \"anchors\": [\n {\n \"cutoffDay\": 1,\n \"day\": 1,\n \"month\": 1,\n \"type\": \"MONTHDAY\"\n }\n ],\n \"cutoff\": 1,\n \"intent\": \"FULFILLMENT_BEGIN\",\n \"interval\": \"DAY\",\n \"intervalCount\": 1,\n \"preAnchorBehavior\": \"ASAP\"\n }\n },\n \"description\": \"<your-description>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"inventoryPolicy\": {\n \"reserve\": \"ON_FULFILLMENT\"\n },\n \"metafields\": [\n {\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"key\": \"<your-key>\",\n \"namespace\": \"<your-namespace>\",\n \"type\": \"<your-type>\",\n \"value\": \"<your-value>\"\n }\n ],\n \"name\": \"<your-name>\",\n \"options\": [\n \"<your-options>\"\n ],\n \"position\": 1,\n \"pricingPolicies\": [\n {\n \"fixed\": {\n \"adjustmentType\": \"FIXED_AMOUNT\",\n \"adjustmentValue\": {\n \"fixedValue\": \"29.99\",\n \"percentage\": 1.1\n },\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n },\n \"recurring\": {\n \"adjustmentType\": \"FIXED_AMOUNT\",\n \"adjustmentValue\": {\n \"fixedValue\": \"29.99\",\n \"percentage\": 1.1\n },\n \"afterCycle\": 1,\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n }\n }\n ]\n }\n ]\n }\n}"
Schema Reference for MUTATION: sellingPlanGroupUpdate
"input SellingPlanGroupInput {\n appId: String\n description: String\n merchantCode: String\n name: String\n options: [String!]\n position: Int\n sellingPlansToCreate: [SellingPlanInput!]\n sellingPlansToDelete: [ID!]\n sellingPlansToUpdate: [SellingPlanInput!]\n}\n\ninput SellingPlanInput {\n billingPolicy: SellingPlanBillingPolicyInput\n category: SellingPlanCategory\n deliveryPolicy: SellingPlanDeliveryPolicyInput\n description: String\n id: ID\n inventoryPolicy: SellingPlanInventoryPolicyInput\n metafields: [MetafieldInput!]\n name: String\n options: [String!]\n position: Int\n pricingPolicies: [SellingPlanPricingPolicyInput!]\n}\n"
Display Examples for MUTATION: sellingPlanGroupUpdate
[ { "example": { "type_name": "sellingplangroupupdate", "title": "Update a selling plan group and its metafields", "query_string": "mutation sellingPlanGroupUpdate($id: ID!, $input: SellingPlanGroupInput!) {\n sellingPlanGroupUpdate(id: $id, input: $input) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n metafields(first: 1) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}", "query_arguments": { "id": "$id", "input": "$input" }, "variables": { "id": "gid://shopify/SellingPlanGroup/964742479", "input": { "sellingPlansToUpdate": [ { "id": "gid://shopify/SellingPlan/563068713", "metafields": [ { "value": "waterproof", "type": "single_line_text_field", "key": "test_key", "namespace": "example-selling-plan" } ] } ] } }, "response": { "data": { "sellingPlanGroupUpdate": { "sellingPlanGroup": { "id": "gid://shopify/SellingPlanGroup/964742479", "sellingPlans": { "edges": [ { "node": { "id": "gid://shopify/SellingPlan/563068713", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/616145134", "namespace": "example-selling-plan", "key": "test_key", "value": "waterproof" } } ] } } } ] } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/mutations/selling_plan_group_update_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation sellingPlanGroupUpdate($id: ID!, $input: SellingPlanGroupInput!) { sellingPlanGroupUpdate(id: $id, input: $input) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id metafields(first: 1) { edges { node { id namespace key value } } } } } } } userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/SellingPlanGroup/964742479\",\n \"input\": {\n \"sellingPlansToUpdate\": [\n {\n \"id\": \"gid://shopify/SellingPlan/563068713\",\n \"metafields\": [\n {\n \"value\": \"waterproof\",\n \"type\": \"single_line_text_field\",\n \"key\": \"test_key\",\n \"namespace\": \"example-selling-plan\"\n }\n ]\n }\n ]\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation sellingPlanGroupUpdate($id: ID!, $input: SellingPlanGroupInput!) {\n sellingPlanGroupUpdate(id: $id, input: $input) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n metafields(first: 1) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/SellingPlanGroup/964742479\",\n \"input\": {\n \"sellingPlansToUpdate\": [\n {\n \"id\": \"gid://shopify/SellingPlan/563068713\",\n \"metafields\": [\n {\n \"value\": \"waterproof\",\n \"type\": \"single_line_text_field\",\n \"key\": \"test_key\",\n \"namespace\": \"example-selling-plan\"\n }\n ]\n }\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\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 sellingPlanGroupUpdate($id: ID!, $input: SellingPlanGroupInput!) {\n sellingPlanGroupUpdate(id: $id, input: $input) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n metafields(first: 1) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/SellingPlanGroup/964742479\",\n \"input\": {\n \"sellingPlansToUpdate\": [{\"id\"=>\"gid://shopify/SellingPlan/563068713\", \"metafields\"=>[{\"value\"=>\"waterproof\", \"type\"=>\"single_line_text_field\", \"key\"=>\"test_key\", \"namespace\"=>\"example-selling-plan\"}]}]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation sellingPlanGroupUpdate($id: ID!, $input: SellingPlanGroupInput!) {\n sellingPlanGroupUpdate(id: $id, input: $input) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n metafields(first: 1) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/SellingPlanGroup/964742479\",\n \"input\": {\n \"sellingPlansToUpdate\": [\n {\n \"id\": \"gid://shopify/SellingPlan/563068713\",\n \"metafields\": [\n {\n \"value\": \"waterproof\",\n \"type\": \"single_line_text_field\",\n \"key\": \"test_key\",\n \"namespace\": \"example-selling-plan\"\n }\n ]\n }\n ]\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation sellingPlanGroupUpdate($id: ID!, $input: SellingPlanGroupInput!) {\n sellingPlanGroupUpdate(id: $id, input: $input) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n metafields(first: 1) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/SellingPlanGroup/964742479\",\n \"input\" => [\n \"sellingPlansToUpdate\" => [{\"id\"=>\"gid://shopify/SellingPlan/563068713\", \"metafields\"=>[{\"value\"=>\"waterproof\", \"type\"=>\"single_line_text_field\", \"key\"=>\"test_key\", \"namespace\"=>\"example-selling-plan\"}]}],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The Selling Plan Group to update.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/SellingPlanGroup/964742479\"", "typeKind": "MUTATION" }, { "arg": { "name": "input", "description": "The properties of the Selling Plan Group to update.", "type": { "kind": "INPUT_OBJECT", "name": "SellingPlanGroupInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "SellingPlanGroupInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"sellingPlansToUpdate\":[{\"id\":\"gid://shopify/SellingPlan/563068713\",\"metafields\":[{\"value\":\"waterproof\",\"type\":\"single_line_text_field\",\"key\":\"test_key\",\"namespace\":\"example-selling-plan\"}]}]}", "typeKind": "MUTATION" } ] } ]