Single Order GraphQL Query Responds with pageInfo.hasNextPage == true

Highlighted
Shopify Partner
41 4 5

Edit: NVM I figured out what I was doing wrong.

 

Hi I'm executing a GraphQL query similar to the following:

 

{
  shop {
    name
    orders(first:1, query: "gid://shopify/Order/xxxxxxxxxxxx" ) {
      edges {
        node {
          lineItems(first:50) {
            ...
          }
          cancelReason
          cancelledAt
          cartDiscountAmount
          ...
          unpaid
          updatedAt
          transactions {
            ...
          }
        }
        cursor
      }
      pageInfo {
        hasNextPage
      }
    }
  }
}

With this query I would expect a single order to be returned and the shop.orders.pageInfo.hasNextPage == false. However, the query always returns the value as true which is unexpected as there can't be more pages when there is only one possible result.

 

Is this intentional, am I missing here, or is something else going on?

 

Thanks in advance!

0 Likes
Highlighted
Shopify Partner
67 5 27

Edit: NVM I figured out what I was doing wrong.

Can you also provide your solution? You can bet that someone else will land on this question, and would like to know the answer as well 🙂

0 Likes
Highlighted
Shopify Partner
41 4 5

The query was fundamentally wrong. The correct approach would be the following query:

 

 

{
  order(id:"gid://shopify/Order/xxxxxxxxxxxx") {
    ......
  }
}

 

in the other query the query param had no effect, and generally you should avoid the whole store entry point unless you need store config info.