Re: How to add phone number in customer register page?- Dawn theme

Re: How to add phone number in customer register page?- Dawn theme

bhumip
Shopify Partner
8 0 2

Hi,

I want to add phone in account register page, so I have added new field with below code but it's not working, can you please guide me on the same?

<div class="field">
<input
type="text"
name="customer[phone]"
id="RegisterForm-phone"
{% if form.phone %}value="{{ form.phone }}"{% endif %}
placeholder="{{ 'customer.register.phone' | t }}"
>
<label for="RegisterForm-phone">
{{ 'customer.register.phone' | t }}
</label>
</div>
Shopify is best.
Replies 5 (5)

KetanKumar
Shopify Partner
37622 3670 12166

@bhumip 

can you please share full code 

If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
bhumip
Shopify Partner
8 0 2

Hi,

 

Here you can see full code, I want to add phone field at the time of user registration and want to store in phone field in customer section, you can see in below screenshots what I have tried and what I want to achieve.

frontend: https://prnt.sc/26skq36

backend code: https://prnt.sc/26skqbg

what I want to achieve: https://prnt.sc/26skrdk

 

I hope I make this question clear with all above description. Thank you in advance!

Shopify is best.
KetanKumar
Shopify Partner
37622 3670 12166

@bhumip 

<div id="phone_number" class="clearfix large_form">
<label for="phone_number" class="login">Phone Number</label>
<input type="phone_number" class="form-control" name="customer[phone_number]" id="phone_number" class="large" size="30" />
</div
If helpful then please Like and Accept Solution. Partnership of your ️ Coffee Tips and my code can bring miracles.
Want to modify or custom changes on store Hire Me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
umesh-fresh
Shopify Partner
2 0 0

This solution does not work.  could you please suggest?

annabeth_chase
Shopify Partner
21 0 2

probably too late to answer but this worked for me:

{{ customer.default_address.phone }}

 

Here's the sample code for the input field:

<input class="#form-input" autocomplete="tel" type="tel" id="ContactForm-phone" name="contact[phone]" value="{% if form.phone %}{{ form.phone | escape }}{% elsif customer %}{{ customer.default_address.phone | escape }}{% endif %}" placeholder="{{ 'templates.contact.form.phone' | t }}">


NOTE: This only extracts the phone number from the default_address.

So, you need to extract the default_address name, email and other details too.

{{ customer.default_address.name }} <!-- get Name from Default Address  -->
{{ customer.default_address.email }} <!-- get Email from Default Address  -->


Sample Output:
ss2.png

Novice Web Developer & Designer. I jump on these forums in my free time to help and gain some insights. Not looking to be hired, and not looking for work. Designs: https://www.behance.net/christinejanedesigns