Add custom fields after user has registered

Solved

Add custom fields after user has registered

Abhinay
Visitor
3 0 0

I am using Dawn theme and the customer registration process is kept the same (customers enter their email address, the website send a verification code to the said email address, customer enters the code and logs in).  After the customer logs in I want to add additional form where I ask customers if they want to join our testing panel  and if they click on yes I want to collect customers age, product preference, health concerns faced by them etc. 

Accepted Solution (1)

oscprofessional
Shopify Partner
16343 2438 3177

This is an accepted solution.

Hi @Abhinay ,

To redirect users to a contact form after login and collect additional data (age, product preference, health concerns), follow these steps:

Steps to Implement

1. Redirect Users After Login

Modify customers/login.liquid to redirect users to the contact form after successful login.

 

<script>
  document.addEventListener("DOMContentLoaded", function () {
    if (window.location.href.includes("account")) {
      window.location.href = "/pages/testing-panel-form"; // Redirect to your custom form
    }
  });
</script>

 

2. Create a Custom Contact Form

Go to Shopify Admin → Online Store → Pages → Add Page

  • Title: Testing Panel Form
  • Template: page.contact

In Edit Code, modify page.contact.liquid (or create a new template).

Example Contact Form Code (templates/page.testing-panel.liquid)

 

{% section 'contact-form' %}

{% schema %}
{
  "name": "Testing Panel Form",
  "settings": []
}
{% endschema %}

 

Then, edit sections/contact-form.liquid and add custom fields:

 

<form method="post" action="/contact#contact_form" id="contact_form" accept-charset="UTF-8">
  <input type="hidden" name="form_type" value="contact">
  <input type="hidden" name="utf8" value="✓">

  <label for="name">Name</label>
  <input type="text" id="name" name="contact[name]" required>

  <label for="email">Email</label>
  <input type="email" id="email" name="contact[email]" required>

  <label for="age">Age</label>
  <input type="number" id="age" name="contact[age]" min="18" required>

  <label for="product_preferences">Product Preferences</label>
  <input type="text" id="product_preferences" name="contact[product_preferences]">

  <label for="health_concerns">Health Concerns</label>
  <textarea id="health_concerns" name="contact[health_concerns]"></textarea>

  <button type="submit">Submit</button>
</form>

 

Hire us | Pass Core Web Vital | B2B Wholesale Experts | Claim Your Free Website Review |
Connect with Us: WhatsApp | Skype: oscprofessionals-87 | Email: pallavi@oscprofessionals.com |
Custom Shopify SolutionsPrivate Apps, Theme Customization & SEO | Digital Marketing |
OSCP Apps: Discount Suite | Wholesale App | Bundle & Upsell | Shipping Discount | and more...

View solution in original post

Replies 2 (2)

oscprofessional
Shopify Partner
16343 2438 3177

This is an accepted solution.

Hi @Abhinay ,

To redirect users to a contact form after login and collect additional data (age, product preference, health concerns), follow these steps:

Steps to Implement

1. Redirect Users After Login

Modify customers/login.liquid to redirect users to the contact form after successful login.

 

<script>
  document.addEventListener("DOMContentLoaded", function () {
    if (window.location.href.includes("account")) {
      window.location.href = "/pages/testing-panel-form"; // Redirect to your custom form
    }
  });
</script>

 

2. Create a Custom Contact Form

Go to Shopify Admin → Online Store → Pages → Add Page

  • Title: Testing Panel Form
  • Template: page.contact

In Edit Code, modify page.contact.liquid (or create a new template).

Example Contact Form Code (templates/page.testing-panel.liquid)

 

{% section 'contact-form' %}

{% schema %}
{
  "name": "Testing Panel Form",
  "settings": []
}
{% endschema %}

 

Then, edit sections/contact-form.liquid and add custom fields:

 

<form method="post" action="/contact#contact_form" id="contact_form" accept-charset="UTF-8">
  <input type="hidden" name="form_type" value="contact">
  <input type="hidden" name="utf8" value="✓">

  <label for="name">Name</label>
  <input type="text" id="name" name="contact[name]" required>

  <label for="email">Email</label>
  <input type="email" id="email" name="contact[email]" required>

  <label for="age">Age</label>
  <input type="number" id="age" name="contact[age]" min="18" required>

  <label for="product_preferences">Product Preferences</label>
  <input type="text" id="product_preferences" name="contact[product_preferences]">

  <label for="health_concerns">Health Concerns</label>
  <textarea id="health_concerns" name="contact[health_concerns]"></textarea>

  <button type="submit">Submit</button>
</form>

 

Hire us | Pass Core Web Vital | B2B Wholesale Experts | Claim Your Free Website Review |
Connect with Us: WhatsApp | Skype: oscprofessionals-87 | Email: pallavi@oscprofessionals.com |
Custom Shopify SolutionsPrivate Apps, Theme Customization & SEO | Digital Marketing |
OSCP Apps: Discount Suite | Wholesale App | Bundle & Upsell | Shipping Discount | and more...
Abhinay
Visitor
3 0 0

Perfect! Thank you for the help.