Not able to filter fulfillment orders by status

I am trying to query fulfillment orders with the status “OPEN,” but it returns all unfulfilled orders(including the unpaid ones). How can I query all fulfillment orders that have the status “OPEN” but also have a fulfillBy date?

Hi, there
Try this

query {
  fulfillmentOrders(first: 10, query: "status:OPEN") {
    edges {
      node {
        id
        status
      }
    }
  }
}
1 Like

Yes, thanks. But do you know if there’s a way to filter by status ‘OPEN’ AND payment status ‘Paid’? With the current one, the amount of data retrieved is enormous, and I only need to fetch the paid orders.

How I would approach this, because you will likely need to paginate both orders and potentially fulfillments orders, is to first query for orders

query {
  orders(first: 10, query: "financial_status:paid") {
    pageInfo {
      hasNextPage
      endCursor
    }
    edges {
      node {
        id
        displayFinancialStatus
      }
    }
  }
}

Once you’ve got the orders you can then for each order go paginate the fulfillment orders.

query getOrderByID($id: ID!) {
    order(id: $id) {
      fulfillmentOrders(first: 5, query: "status:OPEN") {
        pageInfo {
          hasNextPage
          endCursor
        }
        edges {
          node {
            id
            status
            supportedActions {
              action
            }
          }
        }
      }
    }
  }

You can then combine your results however you need

1 Like