Customer Account API not returning orders when client email was changed

The query is not returning any orders of a customer after I changed the customer email.

So initially I had a customer with some orders, then I changed the customer email to another through the Shopify Merchant Dashboard. Now, when I perform the query to get the customer orders, it returns empty, however, in the Shopify Merchant Dashboard the same email has orders present.

Here is request id of a request failing: 8e57e866-89aa-41a0-9c13-34fa825d5cc0-1767884818

The query I’m doing.

Query
query GetCustomerOrders(
    $cursor: String,
    $imageTransformInput: ImageTransformInput,
    $ordersCount: Int!,
    $reverse: Boolean!,
    $discountApplicationsCount: Int!,
    $successfulFulfillmentsCount: Int!,
    $fulfillmentLineItemsCount: Int!,
    $lineItemsCount: Int!,
    $language: LanguageCode
) @inContext(language: $language) {
    customer {
        orders(first: $ordersCount, after: $cursor, reverse: $reverse) {
            pageInfo {
                hasNextPage
            },
            edges {
                cursor,
                node {
                    id,
                    lineItems(first: $lineItemsCount) {
                        nodes {
                            currentTotalPrice {
                                amount,
                                currencyCode
                            },
                            customAttributes {
                                key,
                                value
                            },
                            giftCard,
                            image {
                                ...BaseImage
                            },
                            presentmentTitle,
                            price {
                                amount,
                                currencyCode
                            },
                            productId,
                            productType,
                            quantity,
                            refundableQuantity,
                            requiresShipping,
                            sku,
                            title,
                            totalDiscount {
                                amount,
                                currencyCode
                            },
                            totalPrice {
                                amount,
                                currencyCode
                            },
                            variantId,
                            variantOptions {
                                name,
                                value
                            },
                            variantTitle,
                            vendor
                        }
                    }
                    cancelReason,
                    cancelledAt,
                    customerLocale,
                    confirmationNumber,
                    createdAt,
                    edited,
                    currencyCode,
                    discountApplications(first: $discountApplicationsCount) {
                        edges {
                            node {
                                targetSelection,
                                targetType,
                                value {
                                    ... on PricingPercentageValue {
                                        percentage
                                    },
                                    ... on MoneyV2 {
                                        amount
                                    }
                                }
                            }
                        }
                    },
                    email,
                    financialStatus,
                    fulfillments(first: $successfulFulfillmentsCount) {
                        nodes {
                            id,
                            fulfillmentLineItems(first: $fulfillmentLineItemsCount) {
                                nodes {
                                    id,
                                    quantity,
                                    lineItem {
                                        currentTotalPrice {
                                            amount,
                                            currencyCode
                                        },
                                        customAttributes {
                                            key,
                                            value
                                        },
                                        giftCard,
                                        image {
                                            ...BaseImage
                                        },
                                        presentmentTitle,
                                        price {
                                            amount,
                                            currencyCode
                                        },
                                        productId,
                                        productType,
                                        quantity,
                                        refundableQuantity,
                                        requiresShipping,
                                        sku,
                                        title,
                                        totalDiscount {
                                            amount,
                                            currencyCode
                                        },
                                        totalPrice {
                                            amount,
                                            currencyCode
                                        },
                                        variantId,
                                        variantOptions {
                                            name,
                                            value
                                        },
                                        variantTitle,
                                        vendor
                                    }
                                }
                            }
                            createdAt,
                            estimatedDeliveryAt,
                            events(first: 250) {
                                nodes {
                                    happenedAt,
                                    id,
                                    status
                                }
                            },
                            isPickedUp,
                            latestShipmentStatus,
                            requiresShipping,
                            status,
                            trackingInformation {
                                company,
                                number,
                                url
                            },
                            updatedAt
                        }
                    },
                    locationName,
                    name,
                    note,
                    number,
                    paymentInformation {
                        paymentCollectionUrl,
                        paymentStatus,
                        paymentTerms {
                            id,
                            nextDueAt,
                            overdue,
                            paymentTermsName
                        },
                        totalOutstandingAmount {
                            amount,
                            currencyCode
                        },
                        totalPaidAmount {
                            amount,
                            currencyCode
                        }
                    },
                    poNumber,
                    processedAt,
                    refunds {
                        createdAt,
                        id,
                        returnName,
                        totalRefunded {
                            amount,
                            currencyCode
                        },
                        updatedAt
                    },
                    requiresShipping,
                    shippingAddress {
                        id,
                        address1,
                        address2,
                        city,
                        company,
                        country,
                        name,
                        firstName,
                        lastName,
                        phoneNumber,
                        province,
                        territoryCode,
                        zip,
                        zoneCode,
                        formatted(withName: true, withCompany: true),
                        formattedArea,
                    },
                    shippingDiscountAllocations {
                        allocatedAmount {
                            amount,
                            currencyCode
                        },
                        discountApplication {
                            allocationMethod,
                            targetSelection,
                            targetType,
                            value {
                                ... on PricingPercentageValue {
                                    percentage
                                },
                                ... on MoneyV2 {
                                    amount
                                }
                            }
                        },
                    },
                    shippingLine {
                        handle,
                        originalPrice {
                            amount,
                            currencyCode
                        },
                        title
                    },
                    statusPageUrl,
                    subtotal {
                        amount,
                        currencyCode
                    },
                    totalDuties {
                        amount,
                        currencyCode
                    },
                    totalPrice {
                        amount,
                        currencyCode
                    },
                    totalRefunded {
                        amount,
                        currencyCode
                    },
                    totalShipping {
                        amount,
                        currencyCode
                    },
                    totalTax {
                        amount,
                        currencyCode
                    },
                    totalTip {
                        amount,
                        currencyCode
                    },
                    transactions {
                        createdAt,
                        giftCardDetails {
                            balance {
                                amount,
                                currencyCode
                            },
                            last4
                        },
                        id,
                        kind,
                        processedAt,
                        transactionParentId,
                        type,
                        typeDetails {
                            message,
                            name
                        }
                    }
                }
            }
        }
    }
}

Hey Tiago,

What email was it before and what email was it after?

I did find that your request was for a customer of email nunobatista@napps.io

But when I look it up, there are no orders associated to that customer

It seems it was a mistake on our side between production and staging stores, I’m sorry for opening this topic.

All good, glad it was figured out!