What's your biggest current challenge? Have your say in Community Polls along the right column.

GraphQL API - inventory item unitCost permission

Solved

GraphQL API - inventory item unitCost permission

velipekkar
Shopify Partner
4 1 0

On the GraphQL document page about Product Variant it says:

 

 
unitCost
Unit cost associated with the inventory item. Note: the user must have "View product costs" permission granted in order to access this field once product granular permissions are enabled.

https://shopify.dev/docs/api/admin-graphql/2024-10/objects/ProductVariant

 

Where is this "View product costs" permission given to API user?

 

I have set up an application to a store and given it API access scopes read_inventory and read_products. I have created GraphQL query and successfully ran it to get products and inventories from Shopify store. I also get inventory item unit cost if I request it but I would like to hide it from potential users of shop's GraphQL API. So my question is where is "View product costs" permission set, and can I use it to limit API user's access?

Accepted Solution (1)

velipekkar
Shopify Partner
4 1 0

This is an accepted solution.

I got an answer from Shopify support. "View unit costs" permission is a reference to the permission given to store staff account and this cannot be used for limiting access to the unit cost field in the inventory item in GraphQl queries. So, the answer is no, it is not possible to limit API user's access to inventory item unit cost field.

View solution in original post

Reply 1 (1)

velipekkar
Shopify Partner
4 1 0

This is an accepted solution.

I got an answer from Shopify support. "View unit costs" permission is a reference to the permission given to store staff account and this cannot be used for limiting access to the unit cost field in the inventory item in GraphQl queries. So, the answer is no, it is not possible to limit API user's access to inventory item unit cost field.