Required field in contact form Craft theme

Topic summary

Goal: Make specific fields (name, phone number, message) required in the Shopify Craft theme contact form, and adjust label indicators.

What was done:

  • Solution: In Online Store > Themes > Actions > Edit code, open Sections > contact-form.liquid and add the HTML attribute “required” to the relevant elements and the . One reply notes to exclude the input that has autocomplete. Save changes.
  • Result: The original poster confirmed this made the fields required.

Follow-up requests:

  • Make Email not required: No direct code change was provided in the thread to disable required for the email field.
  • Add asterisks to labels: Another user added an asterisk via Theme Content by searching “contact,” then under Templates > Contact Form, inserting a space and “*” next to the label (e.g., Name) to match the email label’s styling.

References and assets:

  • Screenshots were shared to show attribute placement and label styling.
  • A YouTube tutorial was linked for the Dawn theme (conceptually similar but different theme).

Status: Initial requirement solved; email optionality remains unclear/unfinished.

Summarized with AI on January 7. AI used: gpt-5.

Hi!
Im using the Craft theme, and I would like to make the fields “name, phone number and message” as required to fill in. Do I need to edit code?

Thanks a lot!

1 Like

Hi @estherfung ,

You have to add the word required for each inputs and the textarea. Please follow instructions below

  1. From your Admin Page, click Online Store > Themes >Actions > Edit code

  2. In the Section folder, open the contact-form.liquid

  3. Find the all <input, except the input with autocomplete, and add the word required. Refer to the image below.

  1. Do this with the <textarea as well. Follow the image above for placement, make sure to add spaces.

  2. Click SAVE

Thank you so much! It works :slightly_smiling_face:

Could I also ask, how to cancel the required filled in for Email? and to add * on other fills?

Hey, I was able to do this for my own shop by going to Theme Content and searching contact in the search bar, then scrolling all the way to the bottom to Templates and Contact Form and add a space and asterisk next to Name part. This matched the spacing and design of the email one for me. Nothing should need to be done in the email section even though it does not show an asterisk. Hope this helps

Hi @estherfung , need a quick fix for making contact page form fields required in Shopify’s Dawn theme? Check out this short and informative YouTube video: https://www.youtube.com/watch?v=0LI7iyHABpo