Get Order Line Items with Picked Quantity

Hi Community,

Hope all is well to you guys. I would like to ask what is the most optimal query to indicate that the order has started the picking process?

Currently we are using this shipments query to get the all the items of the order that have been picked but the complexity of this query is too high (1001)

  shipments(order_id: "T3JkZXI6MjQxMzAzMzI0") {
    request_id
    complexity
    data(first: 10) {
      edges {
        node {
          completed
          created_date
          delivered
          id
          order_id
          picked_up
          line_items {
            edges {
              node {
                quantity
                id
                line_item_id
                shipment_id
                line_item {
                  sku
                }
              }
            }
          }
        }
      }
    }
  }

Looking forwar for your response. Thank you

Altair

@Edwin

Hello Altair!

The line_items edge can also be filtered with first:int. If no filters are applied, it will default to 100.

Do you have many orders with that many line items? If you don’t you can lower the number of nodes for that edge connection.

You could use the mean or the median of line items per order to find out what the most suitable number would be and then paginate those that have hasNextPage:true. This way, you could even increase the number of shipments.

Please also check the following webhook, as it might be of use if you use MIB o SIB for picking: Webhooks – Developer Resources | ShipHero.

Please let me know if this doesn’t help.

Have a great day!
TomasFD