How can I modify my theme to add more fields to customer registration?

@maritimesaver

Custom fields in the contact form require adding codes to your theme files.

Note: Take a backup of your theme before implementing the solution below.

I followed this tutorial to add the Company Name and Address fields to the Simple theme contact form. I added the code to a fresh install of the theme.

Steps:

  1. From your Shopify admin, go to Online Store > Themes.

  2. Find the theme you want to edit, and then click Actions > Edit code.

  3. In the Templates directory, click page.contact.liquid.

  4. Replace the code with the code below. If you are using the default contact page.


# {{ page.title }}

  {{ page.content }}

  {% form 'contact' %}

    {% if form.posted_successfully? %}
      

        {{ 'contact.form.post_success' | t }}
      

    {% endif %}

    {{ form.errors | default_errors }}

    
    

    
    

    
    

    
    
  
    
    
  
    
    

    

  {% endform %}

  1. Click Save

Now you will see two fields in the contact form. But you need to add language translation fields.

Follow the steps below:

  1. From your Shopify admin, go to Online Store > Themes.

  2. Find the theme you want to edit, and then click Actions > Edit code.

  3. In the Locales directory, click en.default.json.

  4. Search for “contact”: tag.

  5. Add the following code below “phone”: “Phone Number”,

"company": "Company Name", 
      "address": "Address",
  1. Click Save.

Here’s how my contact form looks like:

and in the message in the email: