HELP! Form submit button is taking you to checkout page...?

New Member
1 0 2

I wanted to have two separate product templates on my site so that for some products the customer has to enquire with a form, instead of adding it to their cart. I've basically created a new product template and section then replaced the "add to cart" button with a form. HOWEVER, when the details are entered into the form and you click the "SUBMIT" button, it takes you to the cart page and still adds the product to the cart, instead of submitting the form!! I can't understand what I've done wrong at all!! :( This is the code I've used for the new section page (called "product-template-requires-contact-liquid"):

 

 <div class="form-vertical">
          {% form 'contact' %}
 
            {% comment %}
              Successful message
            {% endcomment %}
            {% if form.posted_successfully? %}
              <p class="note form-success">
                {{ 'contact.form.post_success' | t }}
              </p>
            {% endif %}
 
            {{ form.errors | default_errors }}
 
            <div class="grid grid--small">
              <div class="grid__item large--one-half">
                <label for="ContactFormName" class="hidden-label">{{ 'contact.form.name' | t }}</label>
                <input type="text" id="ContactFormName" class="input-full" name="contact[{{ 'contact.form.name' | t }}]" placeholder="{{ 'contact.form.name' | t }}" autocapitalize="words" value="{% if form.name %}{{ form.name }}{% elsif customer %}{{ customer.name }}{% endif %}">
              </div>
 
              <div class="grid__item large--one-half">
                <label for="ContactFormEmail" class="hidden-label">{{ 'contact.form.email' | t }}</label>
                <input type="email" id="ContactFormEmail" class="input-full" name="contact[email]" placeholder="{{ 'contact.form.email' | t }}" autocorrect="off" autocapitalize="off" value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}">
              </div>
            </div>
 
          
            <label for="ContactFormPhone" class="hidden-label">{{ 'contact.form.phone' | t }}</label>
            <input type="tel" id="ContactFormPhone" class="input-full" name="contact[{{ 'contact.form.phone' | t }}]" placeholder="{{ 'contact.form.phone' | t }}" pattern="[0-9\-]*" value="{% if form.phone %}{{ form.phone }}{% elsif customer %}{{ customer.phone }}{% endif %}">
 
          <div><label for="ContactFormServices"></label>
<input
  class= "input-full"
  textarea rows="2"
  type="text"
  id="ContactFormServices"
  name="contact[Servicesrequested]"
       placeholder="Treatment or Service Requested"</div>
          
            <label for="ContactFormMessage" class="hidden-label">{{ 'contact.form.message' | t }}</label>
            <textarea rows="10" id="ContactFormMessage" class="input-full" name="contact[{{ 'contact.form.message' | t }}]" placeholder="{{ 'contact.form.message' | t }}">{% if form.body %}{{ form.body }}{% endif %}</textarea>
 
            <input type="submit" class="btn right" value="{{ 'contact.form.send' | t }}">
 
          {% endform %}
            {% endform %}
            </div>

 

New Member
2 0 1

Did you ever figure this problem out?? I'm having the exact same issue with my disabled Add to Cart that I replaced with a contact form. Hoping someone will chime in!

New Member
1 0 0

Add the code to the end of the page after </script>

0 Likes