App reviews, troubleshooting, and recommendations
Hello everybody,
The reason i am opening a discussion is that i couldnt find any solutions even via shopify support.
We have a variant lets say warehouse1 that keeps the quantity of the product and we need to change this quantity within our app.
e.x. warehouse1, 1
the problem is although we gave access (dev environment) we keep getting Access denied for inventoryItem
See below the request and the response from the graphql:
Request:
{ product(id: "gid://shopify/Product/6744473632835") { id title images(first: 1) { edges { node { originalSrc } } } variants(first: 1) { edges { node { id price inventoryQuantity inventoryItem { id inventoryLevels(first: 1) { edges { node { id available location { id } } } } } } } } options(first: 1) { name values } } }
Response:
{"data":{"product":null},"errors":[{"message":"Access denied for inventoryItem field. Required access: read_inventory access scope.","locations":[{"line":35,"column":35}],"path":["product","variants","edges",0,"node","inventoryItem"],"extensions":{"code":"ACCESS_DENIED","documentation":"https:\/\/shopify.dev\/api\/usage\/access-scopes","requiredAccess":"read_inventory access scope."}}],"extensions":{"cost":{"requestedQueryCost":13,"actualQueryCost":9,"throttleStatus":{"maximumAvailable":1000,"currentlyAvailable":991,"restoreRate":50}}}}
Any ideas will be much appreciated!
Solved! Go to the solution
This is an accepted solution.
If you are experiencing issues with accessing the inventoryItem field in the Shopify GraphQL API, it is likely that you do not have the correct access scopes for your API client. In order to access the inventoryItem field, you will need the read_inventory access scope, which is not included in the default access scopes for the GraphQL API.
To fix this issue, you can try adding the read_inventory access scope to your API client. You can do this by following these steps:
In the Shopify admin, go to Apps, and click on the app that you are using to access the GraphQL API.
In the app settings, go to the OAuth section, and click on the Edit button next to the API scopes.
In the API scopes list, check the box next to read_inventory, and click on the Save button.
In your code, you will need to update the API client to include the read_inventory access scope when making API requests. This will typically involve adding the scope parameter to the API client configuration, as shown in the example below:
const apiClient = new Shopify({
shopName: "your-shop-name",
accessToken: "your-access-token",
scope: "read_inventory",
});
By adding the read_inventory access scope to your API client, you should be able to access the inventoryItem field in the GraphQL API, and to read and update the inventory quantities for your products. This will enable you to manage your inventory levels using your app, and ensure that your app has the necessary access to the data that it needs.
This is an accepted solution.
I found it, it was easier than we thought, it should be on the installation script of the application. I already had the scopes but this one was missing.
Its when the app authorizes first time on the url /admin/oauth/authorize?client_id=xxxx&grant_options[]=read_inventory...
This is an accepted solution.
If you are experiencing issues with accessing the inventoryItem field in the Shopify GraphQL API, it is likely that you do not have the correct access scopes for your API client. In order to access the inventoryItem field, you will need the read_inventory access scope, which is not included in the default access scopes for the GraphQL API.
To fix this issue, you can try adding the read_inventory access scope to your API client. You can do this by following these steps:
In the Shopify admin, go to Apps, and click on the app that you are using to access the GraphQL API.
In the app settings, go to the OAuth section, and click on the Edit button next to the API scopes.
In the API scopes list, check the box next to read_inventory, and click on the Save button.
In your code, you will need to update the API client to include the read_inventory access scope when making API requests. This will typically involve adding the scope parameter to the API client configuration, as shown in the example below:
const apiClient = new Shopify({
shopName: "your-shop-name",
accessToken: "your-access-token",
scope: "read_inventory",
});
By adding the read_inventory access scope to your API client, you should be able to access the inventoryItem field in the GraphQL API, and to read and update the inventory quantities for your products. This will enable you to manage your inventory levels using your app, and ensure that your app has the necessary access to the data that it needs.
Thank you so much for your reply, our implementation is made with php and curl. How i add the header for the scope in php since i cant find it anywhere.
At the moment we are using X-Shopify-Access-Token: and Content-Type: on the header.
great help!
This is an accepted solution.
I found it, it was easier than we thought, it should be on the installation script of the application. I already had the scopes but this one was missing.
Its when the app authorizes first time on the url /admin/oauth/authorize?client_id=xxxx&grant_options[]=read_inventory...
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025