Anchor to sellingPlanGroupUpdateselling
sellingPlanGroupUpdate
mutation
Requires access scope as well as any of
,
access scopes. Also: The user must have
permissions.
Update a Selling Plan Group.
Anchor to Arguments
Arguments
- •ID!required
The Selling Plan Group to update.
- Anchor to inputinput•Selling
Plan requiredGroup Input! The properties of the Selling Plan Group to update.
Was this section helpful?
Anchor to SellingPlanGroupUpdatePayload returnsSellingPlanGroupUpdatePayload returns
- Anchor to deletedSellingPlanIdsdeleted•
Selling Plan Ids The IDs of the deleted Subscription Plans.
- Anchor to sellingPlanGroupselling•
Plan Group The updated Selling Plan Group.
- Anchor to userErrorsuser•
Errors [SellingPlan non-nullGroup User Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Update a selling plan group and its metafields
- sellingPlanGroupUpdate reference
Examples
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
}
}
}
}
}
}
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();
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"
}
]
}
]
}
},
},
});
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)
Input variables
JSON{
"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
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"
}
}
]
}
}
}