Query selling plans for a product Throwing Access Denied Error

Mohit-Chaudhary
Shopify Partner
2 0 0

Hey there, I have been trying to checkout my Product (having a recurring subscription) with web checkout flow on iOS and found out that to support the product with the subscription you have to implement Native APIs

 

So, I started looking into fetching the products with their subscription plan 

 

Now, the problem is I have been trying to hit the storefront API where I can see the product (recurring subscription) with this link:

https://shopify.dev/docs/custom-storefronts/building-with-the-storefront-api/products-collections/su...

 

But API is throwing the Access Denied Error even after having the expected permission

 

I am getting the below error:

 

"data": {

    "product": null

  },

  "errors": [

    {

      "message": "Access denied for sellingPlanGroup field. Required access: `unauthenticated_read_selling_plans` access scope.",

      "locations": [

        {

          "line": 4,

          "column": 5

        }

      ],

      "path": [

        "product",

        "sellingPlanGroups"

      ],

      "extensions": {

        "code": "ACCESS_DENIED",

        "documentation": "https://shopify.dev/api/usage/access-scopes",

        "required access": "`unauthenticated_read_selling_plans` access scope."

      }

    }

  ]

}

 

I have given the permission “unauthenticated_read_selling_plans” for storefront Access Token, but I am still getting the same error

 

Using the below URL and Graphql Query for my store to fetch the products 👇🏻

 

https://lh-demo-store.myshopify.com/api/2021-10/graphql.json

 

{

  product(handle:"iPhone") {

    requiresSellingPlan

    sellingPlanGroups(first:1) {

      edges {

        node {

          name

          options {

            name

            values

          }

          sellingPlans(first: 3) {

            edges {

              node {

                id

                name

                description

                recurring deliveries

                options {

                  name

                  value

                }

              }

            }

          }

        }

      }

    }

  }

}

 

Please help me with the solution.

 

Reply 1 (1)
Mohit-Chaudhary
Shopify Partner
2 0 0

Any Update Team?