Version: 2024-10
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\": \"query sellingPlanGroups { sellingPlanGroup(id: \\\"gid://shopify/SellingPlanGroup/1\\\") { id, name, merchantCode, appId, description, options, position, createdAt, sellingPlans(first: 1) { edges { node { id } } } productVariants(first: 1) { edges { node { id } } } productVariantCount, summary, products(first: 1) { edges { node { id } } } productCount, appliesToProduct(productId: \\\"gid://shopify/Product/1\\\"), appliesToProductVariant(productVariantId: \\\"gid://shopify/ProductVariant/1\\\") app { id } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query sellingPlanGroups {\n sellingPlanGroup(id: \"gid://shopify/SellingPlanGroup/1\") {\n id,\n name,\n merchantCode,\n appId,\n description,\n options,\n position,\n createdAt,\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariants(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariantCount,\n summary,\n products(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productCount,\n appliesToProduct(productId: \"gid://shopify/Product/1\"),\n appliesToProductVariant(productVariantId: \"gid://shopify/ProductVariant/1\")\n app {\n id\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 query sellingPlanGroups {\n sellingPlanGroup(id: \"gid://shopify/SellingPlanGroup/1\") {\n id,\n name,\n merchantCode,\n appId,\n description,\n options,\n position,\n createdAt,\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariants(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariantCount,\n summary,\n products(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productCount,\n appliesToProduct(productId: \"gid://shopify/Product/1\"),\n appliesToProductVariant(productVariantId: \"gid://shopify/ProductVariant/1\")\n app {\n id\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query sellingPlanGroups {\n sellingPlanGroup(id: \"gid://shopify/SellingPlanGroup/1\") {\n id,\n name,\n merchantCode,\n appId,\n description,\n options,\n position,\n createdAt,\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariants(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariantCount,\n summary,\n products(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productCount,\n appliesToProduct(productId: \"gid://shopify/Product/1\"),\n appliesToProductVariant(productVariantId: \"gid://shopify/ProductVariant/1\")\n app {\n id\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query sellingPlanGroups {\n sellingPlanGroup(id: \"gid://shopify/SellingPlanGroup/1\") {\n id,\n name,\n merchantCode,\n appId,\n description,\n options,\n position,\n createdAt,\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariants(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariantCount,\n summary,\n products(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productCount,\n appliesToProduct(productId: \"gid://shopify/Product/1\"),\n appliesToProductVariant(productVariantId: \"gid://shopify/ProductVariant/1\")\n app {\n id\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query sellingPlanGroups {\n sellingPlanGroup(id: \"gid://shopify/SellingPlanGroup/1\") {\n id,\n name,\n merchantCode,\n appId,\n description,\n options,\n position,\n createdAt,\n sellingPlans(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariants(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productVariantCount,\n summary,\n products(first: 1) {\n edges {\n node {\n id\n }\n }\n }\n productCount,\n appliesToProduct(productId: \"gid://shopify/Product/1\"),\n appliesToProductVariant(productVariantId: \"gid://shopify/ProductVariant/1\")\n app {\n id\n }\n }\n}\n"
input: null
response: { "data": { "sellingPlanGroup": { "id": "gid://shopify/SellingPlanGroup/1", "name": "Subscribe & Save", "merchantCode": "sub-n-save", "appId": "gid://shopify/App/1", "description": null, "options": [ "Delivery every" ], "position": null, "createdAt": "2023-07-16T19:21:25Z", "sellingPlans": { "edges": [ { "node": { "id": "gid://shopify/SellingPlan/1" } } ] }, "productVariants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/1" } } ] }, "productVariantCount": 1, "summary": "1 delivery frequency, 25-26% discount", "products": { "edges": [ { "node": { "id": "gid://shopify/Product/1" } } ] }, "productCount": 1, "appliesToProduct": true, "appliesToProductVariant": true, "app": { "id": "gid://shopify/App/1" } } } }