Commerce: How to save user data (in the order date) when delete it Hi all for one of my client site I use Drupal Commerce. 

Now: when an user make an order his/her uid and email are stored in the order's tables (I don't know which one, but this is not important) and this is ok.

When the user (or the administrator) delete his/her account all orders related to this user lost account information so in commerce there are orders without uid and email, and this is not good: How to know which is the client that have bought the order XYZ ? 

How can I resolve this problem ? Is there the possibility to not delete this information. Other commerce suite like Prestashop op Magento do not have this problem. 

M.
Interesting question.

Though I have never worked with Magento or Prestashop(I have made a simple site with it), so I don't know how they deal with it.

At first I saw your question two days ago &amp; I didn't give much thought about it but today I came again &amp; thought, why do we expect a contributed module to do everything for us? We all have to set our own store &amp; can have different requirement...

Commerce Guys are great &amp; have worked so hard to keep it tight with drupal as well as followed the same way which drupal has done to leave hooks for extending it anywhere you want..

You will have to make your own module for this &amp; will have to play around a bit. It would be very interesting I promise.

There is a hook as I remember hook_commerce_checkout_complete() to get all the info of a order when you are going through checkout.
You can pass $order variable as parameter here &amp; it will have all the value related to current order.
You can check like --

function MYMODULE_commerce_checkout_complete(){
  dpm($order);
}


Now go for buying anything on your instance and see what you get.

So the next you will do is...you can retrieve more data if you want(like user data if it exists in case of authenticate user or what ever you want to save for next) and save it in your own table.
Once you get data...there are many things which you can do now...make your own listing page by executing query or...expose your table to views so you get to feel the power of it for your own data too...

And as this is your table...removing your user or in case he deletes his account will never have any effect on this..GOOD!!