Version: 2025-01
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) { sellingPlanGroupCreate(input: $input, resources: $resources) { sellingPlanGroup { id sellingPlans(first: 1) { edges { node { id } } } } userErrors { field message } } }\",\n \"variables\": {\n \"input\": {\n \"name\": \"Delivered every week and billed every three weeks\",\n \"merchantCode\": \"prepaid-weekly\",\n \"options\": [\n \"1 week\"\n ],\n \"sellingPlansToCreate\": [\n {\n \"name\": \"Delivered every week\",\n \"options\": \"1 Week(s)\",\n \"category\": \"SUBSCRIPTION\",\n \"billingPolicy\": {\n \"recurring\": {\n \"interval\": \"WEEK\",\n \"intervalCount\": 3,\n \"anchors\": [\n {\n \"cutoffDay\": 2,\n \"day\": 4,\n \"type\": \"WEEKDAY\"\n }\n ]\n }\n },\n \"pricingPolicies\": [\n {\n \"fixed\": {\n \"adjustmentType\": \"PERCENTAGE\",\n \"adjustmentValue\": {\n \"percentage\": 25.0\n }\n }\n }\n ],\n \"deliveryPolicy\": {\n \"recurring\": {\n \"interval\": \"WEEK\",\n \"intervalCount\": 1,\n \"anchors\": [\n {\n \"cutoffDay\": 2,\n \"day\": 4,\n \"type\": \"WEEKDAY\"\n }\n ]\n }\n }\n }\n ]\n },\n \"resources\": {\n \"productIds\": [\n \"gid://shopify/Product/121709582\"\n ],\n \"productVariantIds\": []\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"name\": \"Delivered every week and billed every three weeks\",\n \"merchantCode\": \"prepaid-weekly\",\n \"options\": [\n \"1 week\"\n ],\n \"sellingPlansToCreate\": [\n {\n \"name\": \"Delivered every week\",\n \"options\": \"1 Week(s)\",\n \"category\": \"SUBSCRIPTION\",\n \"billingPolicy\": {\n \"recurring\": {\n \"interval\": \"WEEK\",\n \"intervalCount\": 3,\n \"anchors\": [\n {\n \"cutoffDay\": 2,\n \"day\": 4,\n \"type\": \"WEEKDAY\"\n }\n ]\n }\n },\n \"pricingPolicies\": [\n {\n \"fixed\": {\n \"adjustmentType\": \"PERCENTAGE\",\n \"adjustmentValue\": {\n \"percentage\": 25.0\n }\n }\n }\n ],\n \"deliveryPolicy\": {\n \"recurring\": {\n \"interval\": \"WEEK\",\n \"intervalCount\": 1,\n \"anchors\": [\n {\n \"cutoffDay\": 2,\n \"day\": 4,\n \"type\": \"WEEKDAY\"\n }\n ]\n }\n }\n }\n ]\n },\n \"resources\": {\n \"productIds\": [\n \"gid://shopify/Product/121709582\"\n ],\n \"productVariantIds\": []\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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"name\": \"Delivered every week and billed every three weeks\",\n \"merchantCode\": \"prepaid-weekly\",\n \"options\": [\"1 week\"],\n \"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.0}}}], \"deliveryPolicy\"=>{\"recurring\"=>{\"interval\"=>\"WEEK\", \"intervalCount\"=>1, \"anchors\"=>[{\"cutoffDay\"=>2, \"day\"=>4, \"type\"=>\"WEEKDAY\"}]}}}]\n },\n \"resources\": {\n \"productIds\": [\"gid://shopify/Product/121709582\"],\n \"productVariantIds\": []\n }\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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"name\" => \"Delivered every week and billed every three weeks\",\n \"merchantCode\" => \"prepaid-weekly\",\n \"options\" => [\"1 week\"],\n \"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.0}}}], \"deliveryPolicy\"=>{\"recurring\"=>{\"interval\"=>\"WEEK\", \"intervalCount\"=>1, \"anchors\"=>[{\"cutoffDay\"=>2, \"day\"=>4, \"type\"=>\"WEEKDAY\"}]}}}],\n ],\n \"resources\" => [\n \"productIds\" => [\"gid://shopify/Product/121709582\"],\n \"productVariantIds\" => [],\n ],\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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"name\": \"Delivered every week and billed every three weeks\",\n \"merchantCode\": \"prepaid-weekly\",\n \"options\": [\n \"1 week\"\n ],\n \"sellingPlansToCreate\": [\n {\n \"name\": \"Delivered every week\",\n \"options\": \"1 Week(s)\",\n \"category\": \"SUBSCRIPTION\",\n \"billingPolicy\": {\n \"recurring\": {\n \"interval\": \"WEEK\",\n \"intervalCount\": 3,\n \"anchors\": [\n {\n \"cutoffDay\": 2,\n \"day\": 4,\n \"type\": \"WEEKDAY\"\n }\n ]\n }\n },\n \"pricingPolicies\": [\n {\n \"fixed\": {\n \"adjustmentType\": \"PERCENTAGE\",\n \"adjustmentValue\": {\n \"percentage\": 25.0\n }\n }\n }\n ],\n \"deliveryPolicy\": {\n \"recurring\": {\n \"interval\": \"WEEK\",\n \"intervalCount\": 1,\n \"anchors\": [\n {\n \"cutoffDay\": 2,\n \"day\": 4,\n \"type\": \"WEEKDAY\"\n }\n ]\n }\n }\n }\n ]\n },\n \"resources\": {\n \"productIds\": [\n \"gid://shopify/Product/121709582\"\n ],\n \"productVariantIds\": []\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\n sellingPlanGroup {\n id\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}"
input: { "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.0 } } } ], "deliveryPolicy": { "recurring": { "interval": "WEEK", "intervalCount": 1, "anchors": [ { "cutoffDay": 2, "day": 4, "type": "WEEKDAY" } ] } } } ] }, "resources": { "productIds": [ "gid://shopify/Product/121709582" ], "productVariantIds": [] } }
response: { "data": { "sellingPlanGroupCreate": { "sellingPlanGroup": { "id": "gid://shopify/SellingPlanGroup/1039518901", "sellingPlans": { "edges": [ { "node": { "id": "gid://shopify/SellingPlan/1070277392" } } ] } }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"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 } } }\",\n \"variables\": {\n \"input\": {\n \"name\": \"Subscribe and save\",\n \"merchantCode\": \"subscribe-and-save\",\n \"appId\": \"groovy\",\n \"options\": [\n \"Delivery every\",\n \"Delivery interval\",\n \"Fun every\"\n ],\n \"position\": 1,\n \"description\": \"Subscribe and save group\",\n \"sellingPlansToCreate\": [\n {\n \"name\": \"Pay every month deliver every month\",\n \"options\": [\n \"1\",\n \"month\",\n \"day\"\n ],\n \"metafields\": [\n {\n \"namespace\": \"for_testing\",\n \"key\": \"my_key\",\n \"value\": \"selling plan metafield\",\n \"type\": \"single_line_text_field\"\n }\n ],\n \"position\": 1,\n \"category\": \"SUBSCRIPTION\",\n \"billingPolicy\": {\n \"recurring\": {\n \"interval\": \"MONTH\",\n \"intervalCount\": 1,\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 26\n }\n ]\n }\n },\n \"deliveryPolicy\": {\n \"recurring\": {\n \"interval\": \"MONTH\",\n \"intervalCount\": 1,\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 26\n }\n ],\n \"cutoff\": 5,\n \"intent\": \"FULFILLMENT_BEGIN\",\n \"preAnchorBehavior\": \"ASAP\"\n }\n },\n \"inventoryPolicy\": {\n \"reserve\": \"ON_SALE\"\n },\n \"pricingPolicies\": [\n {\n \"fixed\": {\n \"adjustmentType\": \"PERCENTAGE\",\n \"adjustmentValue\": {\n \"percentage\": 25.0\n }\n }\n },\n {\n \"recurring\": {\n \"afterCycle\": 3,\n \"adjustmentType\": \"PERCENTAGE\",\n \"adjustmentValue\": {\n \"percentage\": 26.0\n }\n }\n }\n ]\n }\n ]\n },\n \"resources\": {}\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\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 \"input\": {\n \"name\": \"Subscribe and save\",\n \"merchantCode\": \"subscribe-and-save\",\n \"appId\": \"groovy\",\n \"options\": [\n \"Delivery every\",\n \"Delivery interval\",\n \"Fun every\"\n ],\n \"position\": 1,\n \"description\": \"Subscribe and save group\",\n \"sellingPlansToCreate\": [\n {\n \"name\": \"Pay every month deliver every month\",\n \"options\": [\n \"1\",\n \"month\",\n \"day\"\n ],\n \"metafields\": [\n {\n \"namespace\": \"for_testing\",\n \"key\": \"my_key\",\n \"value\": \"selling plan metafield\",\n \"type\": \"single_line_text_field\"\n }\n ],\n \"position\": 1,\n \"category\": \"SUBSCRIPTION\",\n \"billingPolicy\": {\n \"recurring\": {\n \"interval\": \"MONTH\",\n \"intervalCount\": 1,\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 26\n }\n ]\n }\n },\n \"deliveryPolicy\": {\n \"recurring\": {\n \"interval\": \"MONTH\",\n \"intervalCount\": 1,\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 26\n }\n ],\n \"cutoff\": 5,\n \"intent\": \"FULFILLMENT_BEGIN\",\n \"preAnchorBehavior\": \"ASAP\"\n }\n },\n \"inventoryPolicy\": {\n \"reserve\": \"ON_SALE\"\n },\n \"pricingPolicies\": [\n {\n \"fixed\": {\n \"adjustmentType\": \"PERCENTAGE\",\n \"adjustmentValue\": {\n \"percentage\": 25.0\n }\n }\n },\n {\n \"recurring\": {\n \"afterCycle\": 3,\n \"adjustmentType\": \"PERCENTAGE\",\n \"adjustmentValue\": {\n \"percentage\": 26.0\n }\n }\n }\n ]\n }\n ]\n },\n \"resources\": {}\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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\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 \"input\": {\n \"name\": \"Subscribe and save\",\n \"merchantCode\": \"subscribe-and-save\",\n \"appId\": \"groovy\",\n \"options\": [\"Delivery every\", \"Delivery interval\", \"Fun every\"],\n \"position\": 1,\n \"description\": \"Subscribe and save group\",\n \"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.0}}}, {\"recurring\"=>{\"afterCycle\"=>3, \"adjustmentType\"=>\"PERCENTAGE\", \"adjustmentValue\"=>{\"percentage\"=>26.0}}}]}]\n },\n \"resources\": {\n\n }\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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\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 \"input\" => [\n \"name\" => \"Subscribe and save\",\n \"merchantCode\" => \"subscribe-and-save\",\n \"appId\" => \"groovy\",\n \"options\" => [\"Delivery every\", \"Delivery interval\", \"Fun every\"],\n \"position\" => 1,\n \"description\" => \"Subscribe and save group\",\n \"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.0}}}, {\"recurring\"=>{\"afterCycle\"=>3, \"adjustmentType\"=>\"PERCENTAGE\", \"adjustmentValue\"=>{\"percentage\"=>26.0}}}]}],\n ],\n \"resources\" => [\n ],\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 createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\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 \"input\": {\n \"name\": \"Subscribe and save\",\n \"merchantCode\": \"subscribe-and-save\",\n \"appId\": \"groovy\",\n \"options\": [\n \"Delivery every\",\n \"Delivery interval\",\n \"Fun every\"\n ],\n \"position\": 1,\n \"description\": \"Subscribe and save group\",\n \"sellingPlansToCreate\": [\n {\n \"name\": \"Pay every month deliver every month\",\n \"options\": [\n \"1\",\n \"month\",\n \"day\"\n ],\n \"metafields\": [\n {\n \"namespace\": \"for_testing\",\n \"key\": \"my_key\",\n \"value\": \"selling plan metafield\",\n \"type\": \"single_line_text_field\"\n }\n ],\n \"position\": 1,\n \"category\": \"SUBSCRIPTION\",\n \"billingPolicy\": {\n \"recurring\": {\n \"interval\": \"MONTH\",\n \"intervalCount\": 1,\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 26\n }\n ]\n }\n },\n \"deliveryPolicy\": {\n \"recurring\": {\n \"interval\": \"MONTH\",\n \"intervalCount\": 1,\n \"anchors\": [\n {\n \"type\": \"MONTHDAY\",\n \"day\": 26\n }\n ],\n \"cutoff\": 5,\n \"intent\": \"FULFILLMENT_BEGIN\",\n \"preAnchorBehavior\": \"ASAP\"\n }\n },\n \"inventoryPolicy\": {\n \"reserve\": \"ON_SALE\"\n },\n \"pricingPolicies\": [\n {\n \"fixed\": {\n \"adjustmentType\": \"PERCENTAGE\",\n \"adjustmentValue\": {\n \"percentage\": 25.0\n }\n }\n },\n {\n \"recurring\": {\n \"afterCycle\": 3,\n \"adjustmentType\": \"PERCENTAGE\",\n \"adjustmentValue\": {\n \"percentage\": 26.0\n }\n }\n }\n ]\n }\n ]\n },\n \"resources\": {}\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation createSellingPlanGroup($input: SellingPlanGroupInput!, $resources: SellingPlanGroupResourceInput) {\n sellingPlanGroupCreate(input: $input, resources: $resources) {\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}"
input: { "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.0 } } }, { "recurring": { "afterCycle": 3, "adjustmentType": "PERCENTAGE", "adjustmentValue": { "percentage": 26.0 } } } ] } ] }, "resources": {} }
response: { "data": { "sellingPlanGroupCreate": { "sellingPlanGroup": { "id": "gid://shopify/SellingPlanGroup/1039518902", "sellingPlans": { "edges": [ { "node": { "id": "gid://shopify/SellingPlan/1070277393", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/1069228978", "namespace": "for_testing", "key": "my_key", "value": "selling plan metafield" } } ] } } } ] } }, "userErrors": [] } } }