Vote up!
Vote down!

How do I base a new account username on the Billing Name for an anonymous order?

I don't want to use the current cart owner's email address as the user name for a new account for an anonymous order but the Billing Name instead.

I have cloned the existing rule "Create a new account for an anonymous order" and I am trying to use the "Create a new entity" action to use the Billing Name instead of email address as the new user name.

I have tried to find a Data selector to use to no avail. The commerce-order:commerce-customer-billing:user:name resorts to "Guest" which is my anonymous user.

Asked by: authentictech
on December 17, 2012

2 Answers

Vote up!
Vote down!

Great question! It took me a bit, but here's the solution:

1) Go to the rule "Create a new account for an anonymous order"

2) Click "edit" next to the "Create Entity" action

3) Click "switch to direct input mode"

4) Paste this: [commerce-order:commerce-customer-billing]

An export of this rule: http://pastebin.com/5B3B6Rhz

Josh Miller
Answer by: Josh Miller
Posted: Dec 17, 2012


Vote up!
Vote down!

This doesn't work for me when i try the same name twice. Rules doesn't automatically recognises if a name already exists and adds, for example, a number behind the name. Does anybody know if there is an alternative that considers duplicate names?

Answer by: kleinermann
Posted: Mar 28, 2014