Forum
Add Fields to Customer/Member
I would like Shop customers to provide some additional info about themselves when they register, this includes Phone, Company & Customer Type.
I have created new templates for member.html
& customer.html
to mimic the fields entered when the user registers through customer_create_passwordless.html
and the additional fields now display in the admin for the 'Member' and for the 'Customer' however the fields are always empty even after submitting those field values from the site. Is there anything I need to do to pull the info from the customer_create_passwordless.html
form when it is submitted?
member.html
<perch:members type="text" id="first_name" label="First name" listing="true" order="1" />
<perch:members type="text" id="last_name" label="Last name" listing="true" order="2" />
<perch:members type="text" id="phone" label="Phone" listing="true" order="3" />
<perch:members type="text" id="company" label="Company" listing="true" order="4" />
<perch:members type="radio" id="customer_type" label="Customer type" listing="true" order="5" options="Retail Customer,Student" wrap="div.half-wrapper-radio">
customer.html
<perch:shop id="first_name" type="text" label="First name" required="true" order="1" />
<perch:shop id="last_name" type="text" label="Last name" required="true" order="2" />
<perch:shop id="email" type="email" label="Email" required="true" order="3" />
<perch:shop type="text" id="phone" label="Phone" required="true" order="4" />
<perch:shop type="text" id="company" label="Company" required="true" order="5" />
<perch:shop type="radio" id="customer_type" label="Customer type" required="true" order="6" options="Retail Customer,Student" wrap="div.half-wrapper-radio">
customer_create_passwordless.html
<perch:form next="/shop-checkout" id="register" method="post" app="perch_shop" class="order-form">
<div class="half-wrapper">
<perch:label for="first_name">First name</perch:label>
<perch:input type="text" id="first_name" required="true" label="First name" />
<perch:error for="first_name" type="required">Please add your name</perch:error>
</div>
<div class="half-wrapper end">
<perch:label for="last_name">Last name</perch:label>
<perch:input type="text" id="last_name" required="true" label="Last name" />
<perch:error for="last_name" type="required">Please add your name</perch:error>
</div>
<div>
<perch:label for="email">Email</perch:label>
<perch:input type="email" id="email" required="true" placeholder="you@company.com" helper="PerchMembers_Members::check_email" />
<perch:error for="email" type="required">Please add your email address</perch:error>
<perch:error for="email" type="helper">That email address is already in use</perch:error>
<perch:input type="hidden" id="password" value="__auto__" />
</div>
<div class="half-wrapper">
<perch:label for="phone">Phone</perch:label>
<perch:input type="text" id="phone" label="Phone" />
</div>
<div class="half-wrapper end">
<perch:label for="company">Company</perch:label>
<perch:input type="text" id="company" label="Company" />
</div>
<fieldset>
<legend>Customer Type</legend>
<div>
<perch:input type="radio" id="customer_type" label="Customer type" options="Retail Customer,Student" wrap="div.half-wrapper-radio">
</div>
</fieldset>
<div>
<perch:label for="address_1">Address 1</perch:label>
<perch:input type="text" id="address_1" required="true" label="Address 1" />
<perch:error for="address_1" type="required">Please add the first line of your address</perch:error>
</div>
<div>
<perch:label for="address_2">Address 2</perch:label>
<perch:input type="text" id="address_2" label="Address 2" />
</div>
<div class="half-wrapper">
<perch:label for="postcode">Postal code</perch:label>
<perch:input type="text" id="postcode" label="Postal code" />
</div>
<div class="half-wrapper end">
<perch:label for="city">City</perch:label>
<perch:input type="text" id="city" label="City" />
</div>
<div class="half-wrapper">
<perch:label for="county">State or County</perch:label>
<perch:input type="text" id="county" label="County" />
</div>
<div class="half-wrapper end">
<perch:label for="country">Country</perch:label>
<perch:input type="select" options="<perch:shop id="country_list" />" value="236" id="country" label="Country" />
</div>
<div>
<perch:label for="order_message">Message</perch:label>
<perch:input type="textarea" id="order_message" rows="3" label="Message" />
</div>
<div>
<perch:input id="placeOrder" type="submit" class="btn btn-secondary" value="Place order" />
</div>
<perch:success>
<p>Thanks!</p>
</perch:success>
</perch:form>
When you create a Member via Shop, only first name, last name, email and password are handed across to the Members app currently.
Is there any way to add additional fields to a Customer created via Shop?
Yes, adding them to the
customer.html
master template should do that.Hmm, the fields are there in admin for both Customer and Member, they just aren't populated with the values from
customer_create_passwordless.html
?Sorry to nag on this, so are you saying that the new Customer fields should be populated with the above template? Or is there something I am missing?
I would have thought so, but it's not something I've ever done. If you're saying that they're not and they're not being inserted into the database then the answer is probably no.
I noticed the same issue has come up previously here: https://forum.grabaperch.com/forum/06-24-2016-shop-customer-form-and-registration
It seems like the ability to add additional fields to a Customer/Member is pretty important and would mimic the functionality provided by the Forms app?
Hi Drew, new project and the need for this functionality has come up again, I actually came across this thread after searching the issue on google.
It seems like the ability to add fields outside of the ones you have specified in the
customer-create.html
template inshop > checkout
has come up often. For example phone number is quite important to capture for a customer but there is currently no way to capture it?Can this be added to the roadmap?
Yes, it's on the roadmap. Not much support as yet.
sorry to 'me too' on this, but this is important for me as well.
Give it a vote on the roadmap - I assume it is 'custom fields for customers'
https://trello.com/c/vQx7t8My/45-custom-fields-for-customers
That's the one.