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.


1 Answer 1


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 & I didn't give much thought about it but today I came again & thought, why do we expect a contributed module to do everything for us? We all have to set our own store & can have different requirement...

Commerce Guys are great & 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 & 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 & it will have all the value related to current order. You can check like --

function MYMODULE_commerce_checkout_complete(){

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!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.