Hi!
I am trying to list products with their subscriptions (selling plan groups) using Admin GraphQL API, but I get nothing.
Details:
I have a development shop with Shopify payments in test mode. I installed ReCharge application to manage subscriptins. I created a product and set up subscription for it using ReCharge application. This, I suppose, should have created selling plans for the product.
I installed the Shopify GraphQL App to my store, and I gave it all possible permissions (checked them all at the app installation page).
Now I give the following query in the GraphQL app, using Admin API:
{
sellingPlanGroups(first: 10) {
edges {
node {
products(first: 10) {
edges {
node {
id
description
}
}
}
}
}
}
}
And I get nothing as a result:
{
"data": {
"sellingPlanGroups": {
"edges": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 132,
"actualQueryCost": 2,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 998,
"restoreRate": 50
}
}
}
}
Then I try getting them as a connection from product variants:
{
products(first:5) {
edges {
node {
id,
description,
title,
options {
id,
name
},
variants(first:5) {
edges {
node {
deliveryProfile {
sellingPlanGroups(first:5) {
edges {
node {
id,
description
}
}
}
}
}
}
}
},
cursor
},
pageInfo {
hasNextPage,
hasPreviousPage
}
}
}
Still nothing:
{
"data": {
"products": {
"edges": [
{
"node": {
"id": "gid://shopify/Product/6819008282788",
"description": "Product 1 Description",
"title": "Product 1",
"options": [
{
"id": "gid://shopify/ProductOption/8749626982564",
"name": "Size"
},
{
"id": "gid://shopify/ProductOption/8749673054372",
"name": "Color"
}
],
"variants": {
"edges": [
{
"node": {
"deliveryProfile": {
"sellingPlanGroups": {
"edges": []
}
}
}
},
{
"node": {
"deliveryProfile": {
"sellingPlanGroups": {
"edges": []
}
}
}
},
{
"node": {
"deliveryProfile": {
"sellingPlanGroups": {
"edges": []
}
}
}
},
{
"node": {
"deliveryProfile": {
"sellingPlanGroups": {
"edges": []
}
}
}
},
{
"node": {
"deliveryProfile": {
"sellingPlanGroups": {
"edges": []
}
}
}
}
]
}
},
"cursor": "eyJsYXN0X2lkIjo2ODE5MDA4MjgyNzg4LCJsYXN0X3ZhbHVlIjoiNjgxOTAwODI4Mjc4OCJ9"
}
],
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": 247,
"actualQueryCost": 26,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 974,
"restoreRate": 50
}
}
}
}
I also tried Storefront API:
{
products(first:5) {
edges {
node {
id,
description,
title,
options {
id,
name
},
sellingPlanGroups(first: 5) {
edges {
node {
name
}
}
}
},
cursor
},
pageInfo {
hasNextPage,
hasPreviousPage
}
}
}
But I get access denied error:
{
"data": null,
"errors": [
{
"message": "Access denied for sellingPlanGroups field.",
"locations": [
{
"line": 12,
"column": 3
}
],
"path": [
"products",
"edges",
0,
"node",
"sellingPlanGroups"
],
"extensions": {
"code": "ACCESS_DENIED",
"documentation": "https://shopify.dev/docs/admin-api/access-scopes"
}
}
]
}
What would be a correct way to go?