How to check “Create an account” checkbox by default in WooCommerce?

2
6522

WooCommerce has an option which lets customers create an account during the checkout process. This option can be helpful in a lot of ways – out of which the most important is that the person purchasing a single products can be sent emails for future purchases, discounts, and offers. It can also be used by the customer to track their order (if you are shipping physical goods) and manage their orders.

Allow Creating an Account at WooCommerce Checkout page

First of all the most important thing here is that the checkbox appears at the checkout page. This can be done by going to WooCommerce > Settings > Accounts & Privacy

You shohuld make sure these options are checked:

The last two options are helpful if you want just the checkbox appear, if you uncheck these two options on the checkout page the customers are able to create an account by entering a username and password of their own choice.

The username + password is sent to the customer by email if you check the two options at the bottom since they are automatically generated in that case. The customer is also automatically logged in after placing the order so that’s not an issue.

Make “Create an account” to be default Checked

To make sure that whenever the customer is at the checkout page, they do not forget to check the option to create an account, you can make this option checked by default.

By default in WooCommerce this option is unchecked.

We can use the woocommerce_create_account_default_checked filter to do this. This can be done by creating a child theme and in your functions.php file add the following piece of code:

add_filter('woocommerce_create_account_default_checked', '__return_true');

The checkbox will now be checked by default and customers will not forget to sign up on your website.

Making some other Checkout options checked/unchecked by default

Ship to a different address checked by default

This option is also unchecked by default and the following piece of code can be used to make it checked by default:

add_filter('woocommerce_ship_to_different_address_checked', '__return_true');

Make Terms and condition Checked by Default

You can also make the “Terms and conditions” checkmark to be unchecked or checked by default by using the following code in your functions.php file:

add_filter('woocommerce_terms_is_checked_default', '__return_true');

Conclusion

I hope that helps you out. To add the code you should make sure you have the FTP access to your website. You can install the plugin “Child Theme Creator by Orbisius” to create a child theme and then in the functions.php add the needed code.

2 COMMENTS

  1. Hi Afnan,

    Thanks for the information here. I was wondering if you know how to move the “Create Account” checkbox to a different part of the checkout page. I want to put it next to terms and conditions checkbox, just above the submit button. However I can’t find the name of this checkbox in order to use the “remove_action” and “add_action” commands. Any ideas?

    • Hi, I think this is more custom work and cannot be explained within comments. You basically have to edit the template file and use woocommerce_checkout_before_terms_and_conditions hook to add the account fields and checkbox. I will consider writing a separate post for this in future.

LEAVE A REPLY

Please enter your comment!
Please enter your name here