--- title: sellingPlanGroupCreate - GraphQL Admin description: Creates a Selling Plan Group. api_version: 2025-10 api_name: admin type: mutation api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/mutations/sellingPlanGroupCreate md: https://shopify.dev/docs/api/admin-graphql/latest/mutations/sellingPlanGroupCreate.md --- # selling​Plan​Group​Create mutation 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. Creates a Selling Plan Group. ## Arguments * input [Selling​Plan​Group​Input!](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/SellingPlanGroupInput) required The properties of the new Selling Plan Group. * resources [Selling​Plan​Group​Resource​Input](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/SellingPlanGroupResourceInput) The resources this Selling Plan Group should be applied to. *** ## Selling​Plan​Group​Create​Payload returns * selling​Plan​Group [Selling​Plan​Group](https://shopify.dev/docs/api/admin-graphql/latest/objects/SellingPlanGroup) The created selling plan group object. * user​Errors [\[Selling​Plan​Group​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/SellingPlanGroupUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Create a TBYB selling plan group #### Query ```graphql mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } } ``` #### Variables ```json { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }", "variables": { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }`, { variables: { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } } QUERY variables = { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }`, "variables": { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } }, }, }); ``` #### Response ```json { "sellingPlanGroupCreate": { "sellingPlanGroup": { "id": "gid://shopify/SellingPlanGroup/1039518935", "sellingPlans": { "edges": [ { "node": { "id": "gid://shopify/SellingPlan/1070277430" } } ] } }, "userErrors": [] } } ``` * ### Create a prepaid selling plan group with anchor dates #### Query ```graphql mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } } ``` #### Variables ```json { "input": { "name": "Delivered every week and billed every three weeks", "merchantCode": "prepaid-weekly", "options": [ "1 week" ], "sellingPlansToCreate": [ { "name": "Delivered every week", "options": "1 Week(s)", "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 3, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } } ], "deliveryPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 1, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }", "variables": { "input": { "name": "Delivered every week and billed every three weeks", "merchantCode": "prepaid-weekly", "options": [ "1 week" ], "sellingPlansToCreate": [ { "name": "Delivered every week", "options": "1 Week(s)", "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 3, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } } ], "deliveryPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 1, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }`, { variables: { "input": { "name": "Delivered every week and billed every three weeks", "merchantCode": "prepaid-weekly", "options": [ "1 week" ], "sellingPlansToCreate": [ { "name": "Delivered every week", "options": "1 Week(s)", "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 3, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } } ], "deliveryPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 1, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } } QUERY variables = { "input": { "name": "Delivered every week and billed every three weeks", "merchantCode": "prepaid-weekly", "options": [ "1 week" ], "sellingPlansToCreate": [ { "name": "Delivered every week", "options": "1 Week(s)", "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 3, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } } ], "deliveryPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 1, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }`, "variables": { "input": { "name": "Delivered every week and billed every three weeks", "merchantCode": "prepaid-weekly", "options": [ "1 week" ], "sellingPlansToCreate": [ { "name": "Delivered every week", "options": "1 Week(s)", "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 3, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } } ], "deliveryPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 1, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } }, }, }); ``` #### Response ```json { "sellingPlanGroupCreate": { "sellingPlanGroup": { "id": "gid://shopify/SellingPlanGroup/1039518936", "sellingPlans": { "edges": [ { "node": { "id": "gid://shopify/SellingPlan/1070277431" } } ] } }, "userErrors": [] } } ``` * ### Create a selling plan group with metafields #### Query ```graphql mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id metafields(first: 1) { edges { node { id namespace key value } } } } } } } userErrors { field message } } } ``` #### Variables ```json { "input": { "name": "Subscribe and save", "merchantCode": "subscribe-and-save", "appId": "groovy", "options": [ "Delivery every", "Delivery interval", "Fun every" ], "position": 1, "description": "Subscribe and save group", "sellingPlansToCreate": [ { "name": "Pay every month deliver every month", "options": [ "1", "month", "day" ], "metafields": [ { "namespace": "for_testing", "key": "my_key", "value": "selling plan metafield", "type": "single_line_text_field" } ], "position": 1, "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ] } }, "deliveryPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ], "cutoff": 5, "intent": "FULFILLMENT_BEGIN", "preAnchorBehavior": "ASAP" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } }, { "recurring": { "afterCycle": 3, "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 26 } } } ] } ] }, "resources": {} } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id metafields(first: 1) { edges { node { id namespace key value } } } } } } } userErrors { field message } } }", "variables": { "input": { "name": "Subscribe and save", "merchantCode": "subscribe-and-save", "appId": "groovy", "options": [ "Delivery every", "Delivery interval", "Fun every" ], "position": 1, "description": "Subscribe and save group", "sellingPlansToCreate": [ { "name": "Pay every month deliver every month", "options": [ "1", "month", "day" ], "metafields": [ { "namespace": "for_testing", "key": "my_key", "value": "selling plan metafield", "type": "single_line_text_field" } ], "position": 1, "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ] } }, "deliveryPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ], "cutoff": 5, "intent": "FULFILLMENT_BEGIN", "preAnchorBehavior": "ASAP" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } }, { "recurring": { "afterCycle": 3, "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 26 } } } ] } ] }, "resources": {} } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id metafields(first: 1) { edges { node { id namespace key value } } } } } } } userErrors { field message } } }`, { variables: { "input": { "name": "Subscribe and save", "merchantCode": "subscribe-and-save", "appId": "groovy", "options": [ "Delivery every", "Delivery interval", "Fun every" ], "position": 1, "description": "Subscribe and save group", "sellingPlansToCreate": [ { "name": "Pay every month deliver every month", "options": [ "1", "month", "day" ], "metafields": [ { "namespace": "for_testing", "key": "my_key", "value": "selling plan metafield", "type": "single_line_text_field" } ], "position": 1, "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ] } }, "deliveryPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ], "cutoff": 5, "intent": "FULFILLMENT_BEGIN", "preAnchorBehavior": "ASAP" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } }, { "recurring": { "afterCycle": 3, "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 26 } } } ] } ] }, "resources": {} }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id metafields(first: 1) { edges { node { id namespace key value } } } } } } } userErrors { field message } } } QUERY variables = { "input": { "name": "Subscribe and save", "merchantCode": "subscribe-and-save", "appId": "groovy", "options": [ "Delivery every", "Delivery interval", "Fun every" ], "position": 1, "description": "Subscribe and save group", "sellingPlansToCreate": [ { "name": "Pay every month deliver every month", "options": [ "1", "month", "day" ], "metafields": [ { "namespace": "for_testing", "key": "my_key", "value": "selling plan metafield", "type": "single_line_text_field" } ], "position": 1, "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ] } }, "deliveryPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ], "cutoff": 5, "intent": "FULFILLMENT_BEGIN", "preAnchorBehavior": "ASAP" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } }, { "recurring": { "afterCycle": 3, "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 26 } } } ] } ] }, "resources": {} } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id metafields(first: 1) { edges { node { id namespace key value } } } } } } } userErrors { field message } } }`, "variables": { "input": { "name": "Subscribe and save", "merchantCode": "subscribe-and-save", "appId": "groovy", "options": [ "Delivery every", "Delivery interval", "Fun every" ], "position": 1, "description": "Subscribe and save group", "sellingPlansToCreate": [ { "name": "Pay every month deliver every month", "options": [ "1", "month", "day" ], "metafields": [ { "namespace": "for_testing", "key": "my_key", "value": "selling plan metafield", "type": "single_line_text_field" } ], "position": 1, "category": "SUBSCRIPTION", "billingPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ] } }, "deliveryPolicy": { "recurring": { "interval": "MONTH", "intervalCount": 1, "anchors": [ { "type": "MONTHDAY", "day": 26 } ], "cutoff": 5, "intent": "FULFILLMENT_BEGIN", "preAnchorBehavior": "ASAP" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "pricingPolicies": [ { "fixed": { "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 25 } } }, { "recurring": { "afterCycle": 3, "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 26 } } } ] } ] }, "resources": {} }, }, }); ``` #### Response ```json { "sellingPlanGroupCreate": { "sellingPlanGroup": { "id": "gid://shopify/SellingPlanGroup/1039518934", "sellingPlans": { "edges": [ { "node": { "id": "gid://shopify/SellingPlan/1070277429", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/1069228936", "namespace": "for_testing", "key": "my_key", "value": "selling plan metafield" } } ] } } } ] } }, "userErrors": [] } } ``` * ### sellingPlanGroupCreate reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20createSellingPlanGroup\(%24input%3A%20SellingPlanGroupInput!%2C%20%24resources%3A%20SellingPlanGroupResourceInput\)%20%7B%0A%20%20sellingPlanGroupCreate\(input%3A%20%24input%2C%20resources%3A%20%24resources\)%20%7B%0A%20%20%20%20sellingPlanGroup%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20sellingPlans\(first%3A%201\)%20%7B%0A%20%20%20%20%20%20%20%20edges%20%7B%0A%20%20%20%20%20%20%20%20%20%20node%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20userErrors%20%7B%0A%20%20%20%20%20%20field%0A%20%20%20%20%20%20message%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22input%22%3A%20%7B%0A%20%20%20%20%22name%22%3A%20%22TBYB%22%2C%0A%20%20%20%20%22merchantCode%22%3A%20%22tbyb%22%2C%0A%20%20%20%20%22options%22%3A%20%5B%0A%20%20%20%20%20%20%22Try%20before%20you%20buy%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%22sellingPlansToCreate%22%3A%20%5B%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22name%22%3A%20%22TBYB%22%2C%0A%20%20%20%20%20%20%20%20%22options%22%3A%20%22Try%20free%20for%2014%20days%22%2C%0A%20%20%20%20%20%20%20%20%22category%22%3A%20%22TRY_BEFORE_YOU_BUY%22%2C%0A%20%20%20%20%20%20%20%20%22billingPolicy%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22fixed%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22checkoutCharge%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22type%22%3A%20%22PRICE%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22value%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22fixedValue%22%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22remainingBalanceChargeTrigger%22%3A%20%22TIME_AFTER_CHECKOUT%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22remainingBalanceChargeTimeAfterCheckout%22%3A%20%22P14D%22%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%22inventoryPolicy%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22reserve%22%3A%20%22ON_SALE%22%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%22deliveryPolicy%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22fixed%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22fulfillmentTrigger%22%3A%20%22ASAP%22%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%5D%0A%20%20%7D%2C%0A%20%20%22resources%22%3A%20%7B%0A%20%20%20%20%22productIds%22%3A%20%5B%0A%20%20%20%20%20%20%22gid%3A%2F%2Fshopify%2FProduct%2F121709582%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%22productVariantIds%22%3A%20%5B%5D%0A%20%20%7D%0A%7D) ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }`, { variables: { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } }, }, ); const json = await response.json(); return json.data; } ``` ##### GQL ``` mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } } ``` ##### cURL ``` curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }", "variables": { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } } }' ``` ##### React Router ``` import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }`, { variables: { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } }, }, ); const json = await response.json(); return json.data; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }`, "variables": { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } }, }, }); ``` ##### 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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } } QUERY variables = { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } } response = client.query(query: query, variables: variables) ``` ## Input variables JSON ```json { "input": { "name": "TBYB", "merchantCode": "tbyb", "options": [ "Try before you buy" ], "sellingPlansToCreate": [ { "name": "TBYB", "options": "Try free for 14 days", "category": "TRY_BEFORE_YOU_BUY", "billingPolicy": { "fixed": { "checkoutCharge": { "type": "PRICE", "value": { "fixedValue": 0 } }, "remainingBalanceChargeTrigger": "TIME_AFTER_CHECKOUT", "remainingBalanceChargeTimeAfterCheckout": "P14D" } }, "inventoryPolicy": { "reserve": "ON_SALE" }, "deliveryPolicy": { "fixed": { "fulfillmentTrigger": "ASAP" } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } } ``` ## Response JSON ```json { "sellingPlanGroupCreate": { "sellingPlanGroup": { "id": "gid://shopify/SellingPlanGroup/1039518935", "sellingPlans": { "edges": [ { "node": { "id": "gid://shopify/SellingPlan/1070277430" } } ] } }, "userErrors": [] } } ```