I am using drupal commerce. What I've found out so far is, that when you create a commerce customer, no drupal user is generated. But without a drupal user attached to the customer, you can't use that data in an order. Am I just missing something, or is this the most useless user-management I've ever seen? What do I have from customers if I can't use them.

Do I have to generate a drupal user first, then change to commerce and generate a customer there and attach the drupal user? Any chance for a one-step-solution?


It is not a usual workflow to create customer profiles "by hand" even if the UI allows for this, the normal workflow would be when the user performs an action, the profile is generated, normally when they progress through the checkout process. At the end of the checkout, order, profiles and user are linked together in case of an anonymous purchase.

The same way you can't create a node and assign the author to an unexistant user, you can't create a customer profile and expect that the references appear magically.

Of course you can build a workflow that makes more sense to you and build a useful solution for your use case, one thing you could do is use Rules to generate a user every time you create an anonymous customer profile, but this will probably conflict with the normal checkout process as customer profiles are assigned to anonymous users when there's an anonymous purchase.

I'd create a boolean field attached to the customer profile that reads "Create a user for this profile" or similar and on the Entity creation event in rules, you can add an action that creates the user. You've got a very similar example in the default commerce Checkout rule "Create a new account for an anonymous order" for how to create an user.

  • My problem is, that I've imported about 9000 customers from an old service, and now can't use them cause customers aren't users. I think my solution will be, to dump my import, bulk-generate drupal users for my customers, and the import again, with a customer connected with a drupal-user. But thanks for your help. You made the whole commerce-thing a little clearer to me. – Andi Jul 4 '14 at 14:57
  • I'd user migrate for that, there's a commerce_migrate module that supports all the commerce entities and you can establish dependencies on previous migrations. – pcambra Jul 4 '14 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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