selling Plan Group Updatemutation
mutation
2025-01release candidate
Requires
write_products
access scope as well as any of write_own_subscription_contracts
, write_purchase_options
access scopes. Also: The user must have manage_orders_information
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?
Examples
Hide code
Copy
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 } } }
curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "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 } } }", "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" } ] } ] } } }'
const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql 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 } } }`, { 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" } ] } ] } }, }, ); const data = await response.json();
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 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 } } } QUERY 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 = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "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 } } }`, "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" } ] } ] } }, }, });
use Shopify\Clients\Graphql; $client = new Graphql("your-development-store.myshopify.com", $accessToken); $query = <<<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 } } } QUERY; $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 = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{ "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" } ] } ] } }
Hide code
Response
JSON
{ "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": [] } }