Help How do I add a name section to a newsletter sign up form?

Solved

Help How do I add a name section to a newsletter sign up form?

Adoring
Tourist
15 0 1

Hi there! Thanks in advance for your help. I am currently using this code to ask users to sign up for our newsletter. How do I also ask for their contact name as well as their phone number?

 

 Theme: impulse

Path: snippets/newsletter-form.liquid

Code:


{%- assign newsletter_form_id = 'newsletter-' | append: section_id -%}
{% form 'customer', id: newsletter_form_id %}
{%- if form.posted_successfully? -%}
<div class="note note--success">
{{ 'general.newsletter_form.newsletter_confirmation' | t }}
</div>
{%- endif -%}
{%- if form.errors and form.context == snippet_context -%}
{{ form.errors | default_errors }}
{%- endif -%}


{%- unless form.posted_successfully? -%}
<label for="Email-{{ section_id }}" class="hidden-label">{{ 'general.newsletter_form.newsletter_email' | t }}</label>
<label for="newsletter-form-submit-{{ section_id }}" class="hidden-label">{{ 'general.newsletter_form.submit' | t }}</label>
<input type="hidden" name="contact[tags]" value="prospect,newsletter">
<input type="hidden" name="contact[context]" value="{{ snippet_context }}">
<div class="input-group newsletter__input-group">
<input type="email" value="{% if customer %}{{ customer.email }}{% endif %}" placeholder="{{ 'general.newsletter_form.newsletter_email' | t }}" name="contact[email]" id="Email-{{ section_id }}" class="input-group-field newsletter__input" autocorrect="off" autocapitalize="off" required>
<div class="input-group-btn">
<button type="submit" id="newsletter-form-submit-{{ section_id }}" class="btn" name="commit">
<span class="form__submit--large">{{ 'general.newsletter_form.submit' | t }}</span>
<span class="form__submit--small">
<svg aria-hidden="true" focusable="false" role="presentation" class="icon icon--wide icon-arrow-right" viewBox="0 0 50 15"><title>icon-right-arrow</title><path d="M0 9.63V5.38h35V0l15 7.5L35 15V9.63Z"/></svg>
</span>
</button>
</div>
</div>
{%- endunless -%}
{% endform %}

 

Accepted Solution (1)

Ahmad31
Excursionist
19 3 0

This is an accepted solution.

Ahmad31_0-1727558005036.png

here's how you can do that

View solution in original post

Replies 6 (6)

Ahmad31
Excursionist
19 3 0

This is an accepted solution.

Ahmad31_0-1727558005036.png

here's how you can do that

Adoring
Tourist
15 0 1

Thank you very much Mr. Ahmed, I would like to try it immediately. Can you share the complete code?

Ahmad31
Excursionist
19 3 0

ahmadmahmood6022@outlook.com here is my email where you can contact me to get get complete code

 

Adoring
Tourist
15 0 1

FIRST NAME

LAST NAME

E-MAIL

PHONE

PASSWORD

 

Can it be this way? You can sign up via email from this pop-up window. A password will be required to log in. Can you create a password from here?

Ahmad31
Excursionist
19 3 0

To show the popup, you will need a bit of JavaScript

Adoring
Tourist
15 0 1

Thank you very much, it really helped me a lot, thank you