Skip to content

New customer accounts are pulling sales data from other customers’ from months ago

We recently migrated to a brand new magento 2 build and migrated all previous order data over from the old server to the new server, but now we have a major issue with random and old customer data i.e. addresses inside new user accounts.

I believe the issue is that new customer account ID’s are conflicting with OLD customer account ID’s, but I am unsure how this has happened or how to resolve it.
Customer account conflict with old sale data

A customer reports that in their account, a different customer’s order details appear i.e., order number, name and item purchased.

We have identified the following within the database upon investigating this issue:

  1. The user that reported the issue has an account set up, as confirmed inside customer_entity table, with entity_ID 24660 being allocated to the customer

  2. The user who reported the issue shares the incorrect order number (increment_ID) found within their account, in this example: 000037066

  3. In sales_order table, we find the entry with the increment ID from step 2, in this example: 000037066

  4. Once the entry has been found, we find customer_ID, which matches the entity_ID of the customer who reported the issue in step 1.

  5. It is therefore clear that there is a conflict between customer_id on sales_order table and entity_id on customer_entity table.

Does anyone have any ideas for how to fix these, aside from removing customer_ID from old orders?