<p>To create an account for a Commerce customer you'd use the exact same method as registering a Craft user via the front-end. The only difference would be that you may already have some of their details. You could use their name and email address to autofill these fields, meaning they'd only need to enter a password.</p>

<p>The code to do this can be found in the docs on the <a href="https://craftcms.com/docs/templating/user-registration-form" rel="nofollow noreferrer">User Registration Form</a> page.</p>

CC BY-SA 3.0
2017-05-31T21:00:51.597Z
I create the user as the first step in the checkout process (just an email an password). After registration the cart addresses will be automatically updated and saved in the user profile (ATTENTION: you have to add the craft commerce field "customer info" to the user profile). I works like a charm.
outline4
CC BY-SA 3.0
2017-02-14T15:43:08.483Z
Thanks Luke. So you're suggesting adding a password field at some point in the flow to capture a password and do a POST (ajax maybe) to create the actual account?
Mike
CC BY-SA 3.0
2017-02-14T15:52:33.163Z
Yep, I add a password field on the order summary page - after a successful payment has been made. It uses ajax to submit and display an error or success message.
Luke Pearce
CC BY-SA 3.0
2017-02-14T16:35:02.903Z
Cool - that sounds like just what we need. Thanks!
Mike
CC BY-SA 3.0
2017-02-15T02:12:35.240Z
I wrote a plugin that helps with this a bit, you might find it useful: https://github.com/bossanova808/CommerceRegisterOnCheckout
Jeremy Daalder
CC BY-SA 3.0
2017-02-14T15:08:51.277Z
2017-02-14T15:08:51.277Z
Luke Pearce
<p>Luke's answer above is absolutely right and the simplest approach, but as I commented above, I wrote a plugin for this:</p>

<p><a href="https://github.com/bossanova808/CommerceRegisterOnCheckout" rel="nofollow noreferrer">https://github.com/bossanova808/CommerceRegisterOnCheckout</a></p>

<p>..the reason being that I wanted to integrate registration <em>during</em> the checkout, not after as Luke has done above.  And the motivation for this is that site registration rates plummet (like, by 80%+ in my totally anecdotal data/experience) - if the registration comes AFTER checkout.  We get a MUCH higher rate of people joining (which has all sorts of business benefits for us) - if we integrate it right IN to the checkout flow.  I can't say why that is precisely, but it seems like most folks mentally check out (excuse the pun) the moment they hit 'Submit Order'....</p>

<p>So I wrote the above to allow a more integrated approach, which does much as what you describe - there's an ajax POST but it's during the payment part of the process (i.e. the actual checkout but), and the user is then registered &amp; logged in (and can e.g. be taken then automatically to their orders summary page).  If there is any failure in registration (e.g. they've forgotten they registered before) - we handle that and present whatever we need to (including possibly a pre-filled registration form for them to have another go with).</p>

<p>(BTW I agree - this should definitely be supported by Commerce in core).</p>

CC BY-SA 3.0
2017-02-15T19:29:58.560Z
Great plugin. From a marketing perspective, I would also look at how you're on boarding customers. Why are they not registering? What do they gain? If you have an existing order with their e-mail address, nothing is stopping you from setting up some e-mail marketing automation after they order (but haven't registered) to entice them to "join." "Sign up and receive X off THIS (or next) order; only valid with the next 24 hours!" or whatever.
RitterKnight
CC BY-SA 3.0
2017-02-15T21:31:28.163Z
Agreed (although in some countries you might run afoul of unsolicited email laws).  But listing out the advantages right over the 'Register' box is a good idea.  We find almost everyone registers if you get the flow right, and this makes for much better long term/repeat customer retention.
Jeremy Daalder
CC BY-SA 3.0
2017-02-15T21:40:36.103Z
Yeh obviously abide by any applicable laws. I'd find it hard to believe you'd run afoul because the customer already agreed to do business with you. I don't know what it's like in other countries but in the US, you're continuing the transaction by saying "here's the benefits... you may have missed this when signing up."  This could even be in your "order confirmation" e-mail. It's really  no different than when a company upsells you because it's based on the PRIOR transition. Obviously a grey area of not angering them.. but sometimes a little RELEVANT persistence in the sales process pays off.
RitterKnight
CC BY-SA 3.0
2017-02-15T22:33:16.937Z
Ha yeah I'm probably more paranoid about that than I need to be.  But yep equally good to keep an eye on is whether it will have more positive impact than negative (to both balances and customer happiness!).  I find this a tough line to tread!
Jeremy Daalder
CC BY-SA 3.0
2017-02-15T04:25:17.477Z
2017-02-15T04:25:17.477Z
Jeremy Daalder
<p>Is it possible to register a user for a Craft user account as part of a Craft Commerce checkout flow? Ideally something where you can ask if the user wants to create an account and save their details as part of the checkout flow. Is this doable? (I'm surprised this isn't somehow in Commerce, given how incredibly prevalent such a UX flow is.)</p>

<plugin-craftcommerce><registration>
Register a user as part of a Commerce checkout?
# Register a user as part of a Commerce checkout?

(Asked by: username_0 on 2017-02-14)

Is it possible to register a user for a Craft user account as part of a Craft Commerce checkout flow? Ideally something where you can ask if the user wants to create an account and save their details as part of the checkout flow. Is this doable? (I'm surprised this isn't somehow in Commerce, given how incredibly prevalent such a UX flow is.)

**Tags:** plugin-craftcommerce, registration

---

## 2 answers

### Answer by username_1 on 2017-02-14. Score: 2 | Accepted answer

To create an account for a Commerce customer you'd use the exact same method as registering a Craft user via the front-end. The only difference would be that you may already have some of their details. You could use their name and email address to autofill these fields, meaning they'd only need to enter a password.

The code to do this can be found in the docs on the [User Registration Form](https://craftcms.com/docs/templating/user-registration-form) page.

> **Comments:**
> **username_0**: Thanks Luke. So you're suggesting adding a password field at some point in the flow to capture a password and do a POST (ajax maybe) to create the actual account?  
> **username_1**: Yep, I add a password field on the order summary page - after a successful payment has been made. It uses ajax to submit and display an error or success message.  
> **username_0**: Cool - that sounds like just what we need. Thanks!  
> **username_3**: I wrote a plugin that helps with this a bit, you might find it useful: https://github.com/bossanova808/CommerceRegisterOnCheckout  
> **username_2**: I create the user as the first step in the checkout process (just an email an password). After registration the cart addresses will be automatically updated and saved in the user profile (ATTENTION: you have to add the craft commerce field "customer info" to the user profile). I works like a charm.  

---

### Answer by username_3 on 2017-02-15. Score: 3

Luke's answer above is absolutely right and the simplest approach, but as I commented above, I wrote a plugin for this:

<https://github.com/bossanova808/CommerceRegisterOnCheckout>

..the reason being that I wanted to integrate registration *during* the checkout, not after as Luke has done above. And the motivation for this is that site registration rates plummet (like, by 80%+ in my totally anecdotal data/experience) - if the registration comes AFTER checkout. We get a MUCH higher rate of people joining (which has all sorts of business benefits for us) - if we integrate it right IN to the checkout flow. I can't say why that is precisely, but it seems like most folks mentally check out (excuse the pun) the moment they hit 'Submit Order'....

So I wrote the above to allow a more integrated approach, which does much as what you describe - there's an ajax POST but it's during the payment part of the process (i.e. the actual checkout but), and the user is then registered & logged in (and can e.g. be taken then automatically to their orders summary page). If there is any failure in registration (e.g. they've forgotten they registered before) - we handle that and present whatever we need to (including possibly a pre-filled registration form for them to have another go with).

(BTW I agree - this should definitely be supported by Commerce in core).

> **Comments:**
> **username_4**: Great plugin. From a marketing perspective, I would also look at how you're on boarding customers. Why are they not registering? What do they gain? If you have an existing order with their e-mail address, nothing is stopping you from setting up some e-mail marketing automation after they order (but haven't registered) to entice them to "join." "Sign up and receive X off THIS (or next) order; only valid with the next 24 hours!" or whatever.  
> **username_3**: Agreed (although in some countries you might run afoul of unsolicited email laws).  But listing out the advantages right over the 'Register' box is a good idea.  We find almost everyone registers if you get the flow right, and this makes for much better long term/repeat customer retention.  
> **username_4**: Yeh obviously abide by any applicable laws. I'd find it hard to believe you'd run afoul because the customer already agreed to do business with you. I don't know what it's like in other countries but in the US, you're continuing the transaction by saying "here's the benefits... you may have missed this when signing up."  This could even be in your "order confirmation" e-mail. It's really  no different than when a company upsells you because it's based on the PRIOR transition. Obviously a grey area of not angering them.. but sometimes a little RELEVANT persistence in the sales process pays off.  
> **username_3**: Ha yeah I'm probably more paranoid about that than I need to be.  But yep equally good to keep an eye on is whether it will have more positive impact than negative (to both balances and customer happiness!).  I find this a tough line to tread!  

---

