All things Shopify and commerce
Hi everyone!
I'm using Dawn theme and I want to remove Email input from the contact form.
I removed this part of my code in contact-form.liquid file:
<div class="field field--with-error">
<input
autocomplete="email"
type="email"
id="ContactForm-email"
class="field__input"
name="contact[email]"
spellcheck="false"
autocapitalize="off"
value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}"
aria-required="true"
{% if form.errors contains 'email' %}
aria-invalid="true"
aria-describedby="ContactForm-email-error"
{% endif %}
placeholder="{{ 'templates.contact.form.email' | t }}"
>
<label class="field__label" for="ContactForm-email">{{ 'templates.contact.form.email' | t }} <span aria-hidden="true">*</span></label>
{%- if form.errors contains 'email' -%}
<small class="contact__field-error" id="ContactForm-email-error">
<span class="visually-hidden">{{ 'accessibility.error' | t }}</span>
<span class="form__message">{% render 'icon-error' %}{{ form.errors.translated_fields['email'] | capitalize }} {{ form.errors.messages['email'] }}</span>
</small>
{%- endif -%}
</div>
And email input was really removed from my contact from, but still when I send Name and phone in my contact form it's written "invalid email".
How can I solve it?
Hello @Ksu10005
You can modify the contact-form.liquid file. Here's how you can do it:
1.Locate the contact-form.liquid file in your theme's code editor.
2.Find the code that represents the email input field. It may look similar to this:
<div class="form__group">
<label for="ContactFormEmail" class="form__label">{{ 'contact.form.email' | t }}</label>
<input type="email" id="ContactFormEmail" name="contact[email]" class="form__input" value="{{ contact.email }}" required>
</div>
3.Remove the entire code block representing the email input field. After removing it, the code should look like this:
<!-- Removed email input field -->
4. Save the changes to the contact-form.liquid file.
By removing the email input field from the contact-form.liquid file, the email field will no longer be displayed in the contact form on your website.
Hello @Ksu10005
The reason why you are still getting an error message about an invalid email address even though you have removed the email input from your contact form is because the email validation logic is still in place.
To fix this, you need to remove the email validation logic from your contact form. You can do this by editing the contact-form.liquid
file and removing the following code:
{% if form.errors contains 'email' %}
<small class="contact__field-error" id="ContactForm-email-error">
<span class="visually-hidden">{{ 'accessibility.error' | t }}</span>
<span class="form__message">{% render 'icon-error' %}{{ form.errors.translated_fields['email'] | capitalize }} {{ form.errors.messages['email'] }}
</span>
</small>
{% endif %}
Once you have removed this code, you should no longer get an error message about an invalid email address when you submit your contact form without an email address.
Hello @magecomp
I did it, but it still shows me Email is invalid
Though I commented all the code with email
I am also trying to do the same. Have you succeeded in doing so? If so, could you share the solution?
This only removes the error message. The validation is still there.
Any luck on this?
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025