Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hey All,
Wondering if anyone has any thought on how to add the first_name and last_name to the new dawn 2.0 theme.
the code is as followed, I thought I would need to add
{form.first_name} and {form.last_name} plus contact[first_name] and contact[last_name] and change the input to text (with some other formating issues), but i cant see to get it to fire.
see code below:
Solved! Go to the solution
This is an accepted solution.
Hi @Chris_Sydney,
You can add these 2 fields:
<div class="field">
<input class="field__input" autocomplete="name" type="text" id="ContactForm-first_name" name="contact[{{ 'customer.register.first_name' | t }}]" value="{% if form.first_name %}{{ form.first_name }}{% elsif customer %}{{ customer.first_name }}{% endif %}" placeholder="{{ 'customer.register.first_name' | t }}">
<label class="field__label" for="ContactForm-first_name">{{ 'customer.register.first_name' | t }}</label>
</div>
<div class="field">
<input class="field__input" autocomplete="name" type="text" id="ContactForm-last_name" name="contact[{{ 'customer.register.last_name' | t }}]" value="{% if form.first_name %}{{ form.last_name }}{% elsif customer %}{{ customer.last_name }}{% endif %}" placeholder="{{ 'customer.register.last_name' | t }}">
<label class="field__label" for="ContactForm-last_name">{{ 'customer.register.last_name' | t }}</label>
</div>
Hope it helps!
Please mark as a solution if you find my answer helpful for you.
This is an accepted solution.
Hi @Chris_Sydney,
You can add these 2 fields:
<div class="field">
<input class="field__input" autocomplete="name" type="text" id="ContactForm-first_name" name="contact[{{ 'customer.register.first_name' | t }}]" value="{% if form.first_name %}{{ form.first_name }}{% elsif customer %}{{ customer.first_name }}{% endif %}" placeholder="{{ 'customer.register.first_name' | t }}">
<label class="field__label" for="ContactForm-first_name">{{ 'customer.register.first_name' | t }}</label>
</div>
<div class="field">
<input class="field__input" autocomplete="name" type="text" id="ContactForm-last_name" name="contact[{{ 'customer.register.last_name' | t }}]" value="{% if form.first_name %}{{ form.last_name }}{% elsif customer %}{{ customer.last_name }}{% endif %}" placeholder="{{ 'customer.register.last_name' | t }}">
<label class="field__label" for="ContactForm-last_name">{{ 'customer.register.last_name' | t }}</label>
</div>
Hope it helps!
Please mark as a solution if you find my answer helpful for you.
Thanks for your feedback on this, That looks like it works but actually I had the inputs right and had a faulty output on the Dawn 2.0 theme that was giving me the wrong error... ending up being a caputa issue with a bad display.
Cheers,
Chris
Hello! Where does this get posted in code and what line? I would like to add First name to my newsletter form on the Dawn theme. Thank you!
Hi @britt-blyth,
Please go to sections/contact-form.liquid file, you can find it here.
Hope it helps!
Hi, May I know which line to place the 2 fields of code in sections/contact-form.liquid file? Thank you
Problem Solved
hi @carven did you find where to put this code? I am looking to add first name only to my newsletter sign up
Hi - This is what happens when I add this code to the bottom of that section. I added it after endschema (line 218 for me). How do I get these fields to be in line with the email field?
User | RANK |
---|---|
42 | |
42 | |
31 | |
9 | |
9 |