Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Access Denied for Orders within 60 days

Solved

Access Denied for Orders within 60 days

ssagli
Shopify Partner
18 3 7

 

// 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)

 

 

Accepted Solution (1)
ssagli
Shopify Partner
18 3 7

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!

View solution in original post

Replies 3 (3)

chris-sellboost
Shopify Partner
22 3 12

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

request_all_orders.png

Regards

ssagli
Shopify Partner
18 3 7

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!

chris-sellboost
Shopify Partner
22 3 12

Ops! maybe this is important, you can not view the orders previously created before you install your app.