Unable to retrieve all line items of the order based on filter limit

Hi, we are unable to retrieve the order line items based on the limit that we set. It seems it always returns the first 100 line items even though the we set the first as 300. On the screenshot attached below, the response shows that there are 128 line items in total but it only retrieved the first 100.

Screenshot 2023-01-17 at 10.31.02 AM

Can you help us check on this as this will cause an issue on our process flow. Here are the following details that you may need:

Request ID: 63c606b3939acab1bbcf6ae9
Request Parameters

query MyQuery {
  order(id: "T3JkZXI6MzI3OTUzMTQ5") {
    request_id
    complexity
    data {
      line_items(first: 300) {
        edges {
          node {
            barcode
            id
            product_name
            quantity
            sku
            warehouse
            warehouse_id
            quantity_shipped
            quantity_pending_fulfillment
            quantity_allocated
            fulfillment_status
          }
          cursor
        }
        total_count
        pageInfo {
          startCursor
          hasPreviousPage
          hasNextPage
          endCursor
        }
      }
    }
  }
}

Looking forward for your prompt response. Thank you.

Regards,
Altair

Cc: @ddl

Hi Altair,

We’ve also run into pagination limits before. Currently ShipHero caps the number of nodes to be returned at 100 when querying edges. You’ll need to paginate through the rest: subsequently query the following 100 nodes until you get all nodes you need.

Good news is: you’re halfway through implementing that already by getting pageInfo. You’ll only need to check in there whether the current edges response hasNextPage. If there are more pages, you can get the last node’s cursor from the current response in endCursor and use that in the after filter for querying the next page.

A more verbose explanation with examples is in the docs on pagination.

Hope this helps!

1 Like