Order search not returning all orders

My app correctly retrieves all orders on an appropriate search that have been created directly by Square (e.g. POS). I have a customer that has recently integrated a web app (using Woo Commerce, I believe) that is putting its orders through Square as well. However, none of those orders show up in any of my Order Search calls. I’ve tried searching for by created date, completed date, open orders, completed orders, etc., but the Woo Commerce orders are never picked up even though the customer can see them in the same list as the native Square orders. Help!

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Orders API Overview
Commerce APIs
Payment APIs

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Do you have any of the order_ids that aren’t being returned in the SearchOrders query? :slightly_smiling_face:

Unfortunately, no, since it is another app that is adding the orders I can’t seem to retrieve.

Whats the sellers location_id? :slightly_smiling_face:

The sellers location_id is L8WMC41BDJVRA

So when you SearchOrders your not getting this order_id kJKy8LvmOmlTp5TsEDs5nXI8zr6YY back at all using this query?

{
    "location_ids": [
        "L8WMC41BDJVRA"
    ]
}

:slightly_smiling_face:

I believe that is true. I was looking at yesterday’s orders and I retrieved 14 orders, none of which is order_id kJKy8LvmOmlTp5TsEDs5nXI8zr6YY.

If you call RetrieveOrder with order_id kJKy8LvmOmlTp5TsEDs5nXI8zr6YY is it returned by the API? :slightly_smiling_face:

Yes, that works. But I need to find that order with a search, which is not working.

I took a look at your account and this SearchOrders query you ran yesterday returned the order:

{
  "location_ids": [
    "L8WMC41BDJVRA"
  ],
  "return_entries": false,
  "query": {
    "filter": {
      "state_filter": {
        "states": [
          "COMPLETED"
        ]
      },
      "date_time_filter": {
        "closed_at": {
          "start_at": "2024-01-08T23:59:59Z",
          "end_at": "2024-01-10T01:00:28Z"
        }
      }
    },
    "sort": {
      "sort_field": "CLOSED_AT"
    }
  }
}

:slightly_smiling_face: