Reputation: 655
I can't find any documentation on how to add custom fields for the user registration forum so I tried something but didn't work:
<div class="single-full-width customer">
<div class="login">
{% form 'create_customer' %}
{% if form.errors %}
{% for field in form.errors %}
<p class="input-error-wrapper"><span>{{field}} {{ form.errors.messages[field] }}</span></p>
{% endfor %}
{% endif %}
<p>
<label>First Name:</label>
<input type="text" value="" name="customer[first_name]" class="input-text-1" />
</p>
<p>
<label>Last Name:</label>
<input type="text" value="" name="customer[last_name]" class="input-text-1" />
</p>
<p>
<label>Email Address:</label>
<input type="text" value="" name="customer[email]" class="input-text-1" />
</p>
<p>
<label>Password:</label>
<input type="password" value="" name="customer[password]" class="input-text-1" />
</p>
<p>
<label>Pet Name:</label>
<input type="text" value="" name="customer[pet_name]" class="input-text-1" />
<input type="radio" name="customer[pet]" value="cat">Cat
<input type="radio" name="customer[pet]" value="dog">Dog
</p>
<p class="sign-in">
<label></label>
<a href="#" class="button-1 custom-font-1 trans-1 form-submit-btn"><span>Register</span></a>
<b>or <a href="{{ shop.url }}">Return to store</a></b>
</p>
{% endform %}
</div>
The fields I've added are the text input - pet name and the radio boxes for Cat/Dog. I've used a test account but the output was that nothing is saved. I've used {{ customer.pet_name }} to try and get the saved value but got nothing in return. Any suggestions? Thanks!
Upvotes: 3
Views: 5928
Reputation: 306
we've developed an application that lets you add custom field on the customer registration page, so we easily resolve your problems! The data will be saved into metafields.
This is the app link: https://apps.shopify.com/amplius
You also have 7 days of free trial to try our app for free!
Upvotes: 0
Reputation: 11427
Save your pet name in a tag, or a note since those exist for customers. pet_name obviously is not a customer field.
<p>
<label>Pet Name:</label>
<input type="text" value="" name="customer[note]" class="input-text-1" />
<input type="radio" name="customer[tags]" value="cat">Cat
<input type="radio" name="customer[tags]" value="dog">Dog
</p>
Upvotes: 3