I've got a site using Commerce. On checkout a user is created to allow access to files, order history etc.

I just had a customer that couldn't find his files and discovered that he had two accounts registered to the same email address. So it seems my system isn't checking for accounts already registered to the same email address.

How can I make sure that

  1. There's only registered an account in the event that the email used for the order haven't been used on the site before?
  2. If the email has been used before the new order is attributed to the existing user?


After reading @Neograph734's answer below I checked my rules. And they look right to my eyes, so I'm a bit confused as to what can cause this:

Weight 1: Assign an anonymous order to a pre-existing user

Weight 2: Create a new account for an anonymous order

  • merci for such fast "intervention" ... enjoy the answers you may get! PS: If "commerce" refers to drupal.org/project/commerce, I also recommend to add an hyperlink to that ... (less guessing about questions = increase chances for accurate answers ...) Dec 14, 2015 at 12:15

1 Answer 1


Drupal by default does not allow multiple users with the same email if you try to create them through Drupal forms. If users are created by code this check is not performed.

My best guess it, that this caused by one of the rules Drupal commerce ships with. Specifically the "Create a new account for an anonymous order" rule. This rule fires when a user who is not logged-in completes checkout. It should check if the email is already registered, but might have been altered. Alternatively you might have a similar rule created yourself or by a module that does not check if the e-mail is already existing.

Most of Drupal commerce's behavior is controllable by rules, so I'd start looking there for rules that create users.

  • thanks! Just checked the various rules and two obviously have something to do with this, but from the weight of them this order should've been assigned to the existing user and not a new one... I'll edit the original Q now to include these rules Dec 14, 2015 at 15:58
  • That's odd. Can you reproduce the problem? Try to create a new order on a new account of your own? Perhaps there was a php error somewhere that caused the validation to fail? Sorry, that's all I can suggest for now. Dec 14, 2015 at 16:21
  • OK, thanks. I wasn't able to reproduce. A purchase with my own account email from an incognito browser succeeded in attributing the order to my already existing account Dec 14, 2015 at 22:30
  • Yeah, I was going to say, there's no way for Rules to create a duplicate account either. Are you 100% sure there is no character different in the two accounts' email addresses? Dec 15, 2015 at 13:20
  • @RyanSzrama 100% sure. For privacy reasons I can't post a screendump to document it though;) Dec 26, 2015 at 21:18

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.