A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
// Today's date is 2023-05-17
const vars = { first:10, query:"created_at:>'2023-05-01T00:00:00.000Z'", after:'' }
const query = `query getOrdersByDates($first:Int!, $query:String!, $after: String) {
orders(
first: $first
query: $query
after: $after
) {
edges {
cursor
node {
createdAt
discountApplications(first: 2) {
edges {
node {
value {
... on MoneyV2 {
__typename
amount
currencyCode
}
}
}
}
}
id
refunds(first: 5) {
id
}
subtotalPriceSet {
shopMoney {
amount
currencyCode
}
}
totalPriceSet {
shopMoney {
amount
currencyCode
}
}
totalTaxSet {
shopMoney {
amount
currencyCode
}
}
totalShippingPriceSet {
shopMoney {
amount
currencyCode
}
}
lineItems(first: $first) {
edges {
cursor
node {
id
originalTotalSet {
shopMoney {
amount
currencyCode
}
}
product {
id
}
quantity
variantTitle
title
}
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}`
return shopify.graphql(query, vars)
Solved! Go to the solution
This is an accepted solution.
I go my query working somehow. It may have been the access token wasn't updated with the right scopes. I am just requesting within the past 60 days so it should work without asking for read all orders. thank you for your response tho!
According to the API Limits, you need to request access to all orders scope read_all_orders for your app, for security reasons is limited to the last 60 days by default and need to be approved by Shopify staff.
Check the app setup in your partner dashboard and send the request
Regards
This is an accepted solution.
I go my query working somehow. It may have been the access token wasn't updated with the right scopes. I am just requesting within the past 60 days so it should work without asking for read all orders. thank you for your response tho!
Ops! maybe this is important, you can not view the orders previously created before you install your app.