Let’s find out how to register the new user in Shopify. We will work with this form:
We have the template, which is responsible for registration of the new user, and it is located in templates/customers/register.liquid. If you don’t have it, you can create this file via the admin panel in the theme editor (it goes by default in slate, but it’s a completely different story).
1.Creation of register.liquid file
Let’s go to your current theme in the admin panel, click Actions > Edit code.
After that, we create a new template by clicking the button ‘Add a new template’, select customers/register file from the drop-down list and click ‘Create template’.
Delete everything that you see in this file.
2.Creation of a structure
So, the first step we need to do is to create an appropriate structure.
Add the following code in the register.liquid file:
In Shopify we have a lot of forms for different needs. For example, the form for registration of a new user, authorization form, account activation form, and so on. In this article we will review the form, which is designed to register a new user. The next what we need to do is to add the form to our markup, and you can do this with form tag.
The result should be as follows:
Here we wrap our markup with the tag form, which is responsible for creating a new user. Next step is to add attribute name with appropriate values in our inputs.
We should get following:
Here we simply describe each field what is responsible for. To see the form we have just created, go to yourshop-name.com/account/register. After filling all the fields and clicking Submit, your account should be created. To check whether it is so, enter into the section Customers in your admin panel and look if there is the account you have just created in the list.
That’s all, our registration form is completely done. You need only to stylize it and everything will be perfect.