In this article we will add a form with the ability to add a more detailed description of the user – phone number, address, company name, and so on.
Let’s create a form where the user can write additional information about himself, but we will not model this form in this article.
So, let’s start. We have special template addresses.liquid, which is responsible for adding additional information about the user.
1.Creating a template
If you don’t have this template, you can create it via the admin panel. For this we go to the theme editor, click the button ‘Add a new template’, and create addresses.liquid template.
2.Creating a structure
Paste the code below in the file addresses.liquid, previously removing all that you have there.
The most important here is to prescribe required attributes name in inputs. You can read more detailed about the possible values of attributes name in following documentation - https://help.shopify.com/themes/development/templates/customers-addresses
Next step we should do is to add required form, which is responsible for adding additional information. We have the special form for this:
Add the following code:
Now let’s go to your-store-name.myshopify.com/account/addresses and fill the form we have just created, after filling, click the button “Submit”. After we have added some information, we can look through it via the admin panel in the tab ‘Customers’ by selecting your account, and in the block ‘DEFAULT ADDRESS’ will be displayed information we have filled in the form.
We also need to write following values in the inputs:
We are doing this for when the next time we want to go to the addresses page again, after we have filled these fields and sent the form, we will see the following picture:
So we have just substituted values that we have filled in before.
Политика конфиденциальности и использования файлов сookie: Этот сайт использует файлы cookie. Продолжая пользоваться этим сайтом, вы соглашаетесь с их использованием.
Дополнительную информацию, в том числе об управлении файлами cookie, можно найти здесь:
Политика использования файлов cookie