# Order for different customer returned when using customer.lastOrder

**URL:** <https://community.shopify.dev/t/order-for-different-customer-returned-when-using-customer-lastorder/2009>\
**Category:** GraphQL Admin API Troubleshooting\
**Tags:** general-gql-troubles\
**Created:** [November 7, 2024, 4:38pm UTC](https://community.shopify.dev/t/order-for-different-customer-returned-when-using-customer-lastorder/2009 "2024-11-07T16:38:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Sam](https://community.shopify.dev/u/Sam)\
**Post date:** [November 7, 2024, 4:38pm UTC](https://community.shopify.dev/t/order-for-different-customer-returned-when-using-customer-lastorder/2009/1 "2024-11-07T16:38:17Z")

</div>

Making the below call in GraphQL to determine the first and last order for a customer.

I have also included the result below the query. Note that the request is for customer id 7178920099883, but when retrieving the lastOrder for that customer it returns an order from a different customer id (7178816323627).

Has anyone seen this? Any ideas on what might be happening?

```auto
{ customer(id: "gid://shopify/Customer/7178920099883") { 
    id, 
    displayName,
    email
    locale
    lastOrder {processedAt, id, name, customer {id,displayName,email}}
    numberOfOrders
    amountSpent{amount}
    orders(first: 1, sortKey:PROCESSED_AT) {
      edges {
        node {
          processedAt
        }
      }
    }
  }
}

```

It returns the following (PII redacted by me):

```auto
{
  "data": {
    "customer": {
      "id": "gid://shopify/Customer/7178920099883",
      "displayName": ******* ,
      "email": null,
      "locale": "en",
      "lastOrder": {
        "processedAt": "2024-11-05T23:53:06Z",
        "id": "gid://shopify/Order/5492235370539",
        "name": "#904099",
        "customer": {
          "id": "gid://shopify/Customer/7178816323627",
          "displayName": ***** ,
          "email": *****
        }
      },
      "numberOfOrders": "1",
      "amountSpent": {
        "amount": "281.89"
      },
      "orders": {
        "edges": []
      }
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 6,
      "actualQueryCost": 5,
      "throttleStatus": {
        "maximumAvailable": 20000.0,
        "currentlyAvailable": 19995,
        "restoreRate": 1000.0
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![Sam](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Sam](https://community.shopify.dev/u/Sam)\
**Post date:** [November 13, 2024, 5:08pm UTC](https://community.shopify.dev/t/order-for-different-customer-returned-when-using-customer-lastorder/2009/2 "2024-11-13T17:08:15Z")

</div>

@Liam-Shopify Any thoughts on this? Clearly seems to be a bug with the API.
