Discussing Shopify Functions development, deployment, and usage in Shopify apps.
Hi,
I have an app with the scope write_discounts.
I try the following query:
{ automaticDiscountNodes (first: 3) { edges { node { id } } } }
And I get:
{ "data": null, "errors": [ { "message": "Access denied for automaticDiscountNodes field.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "automaticDiscountNodes" ], "extensions": { "code": "ACCESS_DENIED", "documentation": "https://shopify.dev/api/usage/access-scopes" } } ], "extensions": { "cost": { "requestedQueryCost": 5, "actualQueryCost": 2, "throttleStatus": { "maximumAvailable": 1000.0, "currentlyAvailable": 998, "restoreRate": 50.0 } } } }
I use API version 2023-10.
Basically I want to access the current values of the metafields that was set with
Kind regards,
-Louise
Using the query on "metafields" with the unstable API version does not work either - no metafields are returned when querying for owner with the id of the automatic discount node:
query{
metafields(owner: "gid://shopify/DiscountAutomaticNode/1400168874288", first:10){
edges{
node{
key
value
}
}
}
}
{
"data": {
"metafields": {
"edges": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 12,
"actualQueryCost": 2,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 998,
"restoreRate": 50.0
}
}
}
}
Ok finally got it - apparently I can use this query:
query{
discountNodes(first:10){
edges{
node{
id
discount{
__typename
... on DiscountAutomaticApp {
status
title
}
}
metafields(first:10){
edges{
node{
id
key
namespace
value
}
}
}
}
}
}
}