# Filter Orders based on closed date

**URL:** <https://community.shopify.dev/t/filter-orders-based-on-closed-date/2794>\
**Category:** Products and Orders APIs\
**Tags:** admin-api-orders\
**Created:** [November 20, 2024, 8:38pm UTC](https://community.shopify.dev/t/filter-orders-based-on-closed-date/2794 "2024-11-20T20:38:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SRCB](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@SRCB](https://community.shopify.dev/u/SRCB)\
**Post date:** [November 20, 2024, 8:38pm UTC](https://community.shopify.dev/t/filter-orders-based-on-closed-date/2794/1 "2024-11-20T20:38:12Z")

</div>

I wanted to know if there is any way to query [orders](https://shopify.dev/docs/api/admin-graphql/2024-01/queries/orders#argument-query) based on the [ClosedAt](https://shopify.dev/docs/api/admin-graphql/2024-01/objects/Order#field-closedat) date.

---

<div class="post-metadata">

**Author:** ![Liam-Shopify](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/liam-shopify/32/6_2.png) [@Liam-Shopify](https://community.shopify.dev/u/Liam-Shopify)\
**Post date:** [November 21, 2024, 1:23pm UTC](https://community.shopify.dev/t/filter-orders-based-on-closed-date/2794/2 "2024-11-21T13:23:59Z")

</div>

Hi SRCB,

This should be possible, eg: if you want to query orders where closedAt date is before Jan 1st 2024, your query would look like:

```auto
query OrdersClosedBefore {
  orders(first: 10, query: "closed_at:<2024-01-01") {
    edges {
      node {
        id
        closedAt
        name
        totalPriceSet {
          shopMoney {
            amount
            currencyCode
          }
        }
      }
    }
  }
}

```

I tested the above in my dev store and it returned orders as expected where closedAt date was before Jan 1st 2024.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![SRCB](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@SRCB](https://community.shopify.dev/u/SRCB)\
**Post date:** [November 21, 2024, 2:02pm UTC](https://community.shopify.dev/t/filter-orders-based-on-closed-date/2794/3 "2024-11-21T14:02:56Z")

</div>

Thank you.

It’s not documented [here](https://shopify.dev/docs/api/admin-graphql/2024-07/queries/orders#argument-query) so if it’s meant to work, I think it should be added to the documentation. I feel like if it’s not documented it’s not fully supported, which means it can be broken without notice.

---

<div class="post-metadata">

**Author:** ![SRCB](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@SRCB](https://community.shopify.dev/u/SRCB)\
**Post date:** [November 21, 2024, 2:13pm UTC](https://community.shopify.dev/t/filter-orders-based-on-closed-date/2794/4 "2024-11-21T14:13:15Z")

</div>

Actually I just tested it. It’s returning all orders, not only ones that were closed before Jan 1st 2024. @Liam-Shopify

---

<div class="post-metadata">

**Author:** ![Dylan](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/dylan/32/90_2.png) [@Dylan](https://community.shopify.dev/u/Dylan)\
**Post date:** [November 21, 2024, 2:51pm UTC](https://community.shopify.dev/t/filter-orders-based-on-closed-date/2794/5 "2024-11-21T14:51:46Z")

</div>

Could you share the entire GraphQL query @SRCB ?

The search syntax can be finicky.

When I search by date fields, I noticed I have to wrap the date fields in single quotes sometimes for the operators to filter properly:

```graphql
orders(query:"created_at:>='2024-01-01' AND shippingAddress:*") {
  edges {
     node {
       id
     }
  }
}

```

That query above searches for all orders created after the Jan 1st 2024 and have a shipping address (not digital products).

But the same single quote wrapping might help in your case.

---

<div class="post-metadata">

**Author:** ![SRCB](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@SRCB](https://community.shopify.dev/u/SRCB)\
**Post date:** [November 21, 2024, 3:51pm UTC](https://community.shopify.dev/t/filter-orders-based-on-closed-date/2794/6 "2024-11-21T15:51:29Z")

</div>

This is the full query.

```auto
query OrdersClosedBefore {
  orders(first: 10, query: "closed_at:>=2024-01-01") {
    edges {
      node {
        id
        closedAt
        name
        totalPriceSet {
          shopMoney {
            amount
            currencyCode
          }
        }
      }
    }
  }
}

```

When I swap out closed\_at for created\_at, it works as expected. I already tried using single quotes replacing the query string with this. `closed_at:>='2024-01-01'`  
It didn’t help.

---

<div class="post-metadata">

**Author:** ![SRCB](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@SRCB](https://community.shopify.dev/u/SRCB)\
**Post date:** [June 6, 2025, 4:54pm UTC](https://community.shopify.dev/t/filter-orders-based-on-closed-date/2794/7 "2025-06-06T16:54:44Z")

</div>

Hey all, it’s been quite a while since I created this topic. Can someone from shopify please confirm if filtering by closed date should work? It’s not identified as a valid filter in the documentation for query on [Orders query](https://shopify.dev/docs/api/admin-graphql/latest/queries/orders#argument-query)

If it isn’t supported, is there any plan to support it in the future? If not, how can I request a feature for this?
