There are a lot of good reasons to require a customer account on checkout:

  • It’s easier for customers to manage their orders and get support.
  • It’s for customer to purchase again (all their details are saved).
  • It’s easier for store manager to track life time value of customers.

However, the checkout process for first time customers should still be as seamless as possible. This is why I like to create accounts automatically if the email hasn’t been used before. WooCommerce has this functionality built-in.

How to Set Up Automatic Accounts

Go to your WooCommerce Account Settings and check the following settings:

  • Automatically generate username from customer email.
  • Automatically generate customer password.

Then, under WooCommerce checkout settings, uncheck this settings:

  • Enable guest checkout

Now when a new customer checks out from your site, they’re sent a welcome email with their new account log in information.

Tweaking the Email

The new account email text is generated by this template. By default the email sends new customers a generated username to log into their account. However, users have been able to log in with their email address since WordPress 4.5, so it seems weird to make them remember an arbitrary username we’ve created.

Instead, I send an email that let’s the customer know they can log in with their email:

<?php
/**
* Customer new account email
*
* This template has been overriden to change account creation text.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates/Emails
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<p><?php printf( __( 'An account has been created for you on %1$s.', 'woocommerce' ), esc_html( $blogname ) ); ?></p>
<p><?php printf( __( 'You can log in with your email address: %1$s', 'woocommerce' ), '<strong>' . esc_html( $email->user_email ) . '</strong>' ); ?></p>
<?php if ( 'yes' === get_option( 'woocommerce_registration_generate_password' ) && $password_generated ) : ?>
<p><?php printf( __( 'Your password has been automatically generated: %s', 'woocommerce' ), '<strong>' . esc_html( $user_pass ) . '</strong>' ); ?></p>
<?php endif; ?>
<p><?php printf( __( 'You can access your account area to view your orders and change your password here: %s.', 'woocommerce' ), make_clickable( esc_url( wc_get_page_permalink( 'myaccount' ) ) ) ); ?></p>
<?php do_action( 'woocommerce_email_footer', $email );

If you’re not interested in editing code on your site, you could also use a plugin like Email Customizer for WooCommerce to make the modifications.

Posted by:Devin

I’m a WordPress developer based in Austin, Texas. I run a little theme shop called DevPress and work for a startup called Nano. Find me on twitter @devinsays.

Leave a Reply

Your email address will not be published. Required fields are marked *