# Can GraphQL query for orders that contain particular items

**URL:** <https://developer.squareup.com/forums/t/can-graphql-query-for-orders-that-contain-particular-items/7980>\
**Category:** Questions\
**Tags:** graphql-api\
**Created:** [December 18, 2022, 2:39am UTC](https://developer.squareup.com/forums/t/can-graphql-query-for-orders-that-contain-particular-items/7980 "2022-12-18T02:39:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin-S](https://avatars.discourse-cdn.com/v4/letter/k/4491bb/32.png) [@Kevin-S](https://developer.squareup.com/forums/u/Kevin-S)\
**Post date:** [December 18, 2022, 2:39am UTC](https://developer.squareup.com/forums/t/can-graphql-query-for-orders-that-contain-particular-items/7980/1 "2022-12-18T02:39:51Z")

</div>

Is (now or in the future) Square’s implementation of GraphQL capable of a query for all orders that contain a particular item? For example, _return all closed orders from 2020 whose line items contain caffe mocha._ If so, what would this query look like?

Obviously, I’m hoping there’s a way to do this, as the alternative seems to be SearchOrders returning a large number of orders, then filtering nearly all of them away by scanning their line items, which would be a lot slower. Given that on Square Dashboard, you can do my proposed query quite quickly, I’m thinking this should be quite viable.

Thanks

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [December 22, 2022, 1:33am UTC](https://developer.squareup.com/forums/t/can-graphql-query-for-orders-that-contain-particular-items/7980/2 "2022-12-22T01:33:05Z")

</div>

I am so sorry for the delay. At this time the ability to parse orders for a text like “_caffe mocha_” or the `variation_id` in an order isn’t currently available. You can pass in a list of orders and return all the `catalog_object_ids` and the `name` of the line item. That query would look like:

```auto
{
    orders(
        filter: {
                  ids: { equalToAnyOf: [
                "bWBhGyQnqw6PTCFdfRKGzEzjGJCZY",
                "t1EBocwqjBilGJ2OfzkdzKW2IrYZY"
            ]
        }
                        merchants: { equalToAnyOf: ["0F5SS1WQBNTGG"]}
    }
    ){
        nodes {
             lineItems{
                 name
                 itemVariation{
                     id
                 }
             }
        }
    }
}

```

🙂
