Create your own ecommerce website and start selling successfully with ShopWired today

Create your ecommerce website on ShopWired today.
Start today with 14 days free

Create your own ecommerce website and start selling successfully with ShopWired today

Create your ecommerce website on ShopWired today.
Start today with 14 days free

Allow customers to create an account at checkout

Theme Customisations - Coding
12th March 2021

Before you proceed:
The following article contains information that requires you to have some prior knowledge about coding in order to correctly implement the proposed change to your theme. If done incorrectly alterations made to your theme’s code can negatively impact your website causing visual and performance issues. Therefore, we strongly recommend that you only undertake this effort if you are completely confident that you know what you’re doing. If you have no coding experience at all, aren’t entirely comfortable following the instructions in this article or if you simply don’t understand the instructions then we recommend you instead contact our partners, Coding Masters, who will complete the work for you for a set fee.


Pro tip!

If you're using Platform Checkout you don't need to edit your theme's files to make this customisation. You simply need to alter this setting with the platform checkout customisation settings.


Depending on your checkout flow you might not be asking customers to create an account during the checkout process. This can be a good idea if you're worried about checkout drop-outs and want to minimise the amount of time it takes to checkout.

If so, you might still want to encourage your visitors to create an account with you, but directly on the checkout page (with minimal fuss).

In the example above, the customer just needs to tick to say that they want to create an account and then enter a password.

If they do so, once the checkout form is submitted (even if payment isn't complete) an account will be created for them.


Adding the code

You'll need two addition fields on your checkout_address.twig page in a suitable position.

<input type="checkbox" name="create_new_customer">

The above will display a tick box that must be ticked by the customer if they want to create an account.

<input type="password" name="new_customer_password">

The above will display a password field that also must be completed.

These fields will need to be styled so that they appear nicely and in keeping with the rest of your website's design.

You could use jQuery to show/hide the password field depending on whether the tick box has been ticked.


Customers that are already logged in

You should hide the fields described above if the customer is already logged into an account using the variable global.customer.id which will return true if the customer is logged into either a customer or trade account:

{% if not global.customer.id %}
        <p><label>Tick here to create an account for faster checkout</label><input type="checkbox" name="create_new_customer"></p>
        <p><label>Enter your password</label><input type="password" name="new_customer_password"></p>
{% endif %}