Get Shipments by order_number

Hi

Can we get Shipments via Order β†’ order_number ?

To get order_id, we need to make two calls first to get order_id and then shipment.

Thanks

Hi risham,

One thing you could do is use the β€œorders” query and drill down to shipments from there. For example:

query {
  orders(order_number: "your_order_number") {
    request_id
    complexity
    data (first: 1) {
      edges {
        cursor
        node {
          id
          order_number
          # The rest of the order fields you want
          shipments {
           created_date
           # The rest of the shipment fields you want
           line_items {
            edges {
              node {
                quantity
                # The rest of the line_items fields you want
                line_item {
                  sku
                }
              }
            }
           }
           shipping_labels {
            id
            package_number
            # The rest of the shipping_label fields you want
            } 
          }
        }
      }
    }
  }
}

The caveat is that doing it this way may use more credits than just doing the multiple queries.

Jeremy

2 Likes

Thanks for your reply, I have currently implemented two calls.

  1. To get the order by order number
  2. To get shipments by order id