Help - Contact form field not sending to email

Highlighted
Excursionist
31 0 3

Hi Everyone,

 

I am using Debut Theme

Screen Shot 2020-02-09 at 12.30.17 pm.png

 

 

I have added a contact form to my product pages to replace buy now / add to cart buttons. I have added the code to send all information to my email once someone submits their info but for some reason the "discount code" sends no information, I believe this is an easy fix but not sure where I am going wrong. Screen Shot 2020-02-09 at 12.31.55 pm.png

Here is my code on product - template.liquid

  <div class="contact-form form-vertical">
        {%- assign formId = 'ContactForm' -%}
        {% form 'contact', id: formId %}
          {% include 'form-status', form: form, form_id: formId %}

          <div class="grid grid--half-gutters">
            <div class="grid__item medium-up--one-half">
              <label for="{{ formId }}-name">{{ 'contact.form.name' | t }}</label>
              <input type="text" id="{{ formId }}-name" name="contact[{{ 'contact.form.name' | t }}]" value="{% if form[name] %}{{ form[name] }}{% elsif customer %}{{ customer.name }}{% endif %}">
            </div>
            <div class="grid__item medium-up--one-half">
              <label for="{{ formId }}-email">{{ 'contact.form.email' | t }} <span aria-hidden="true">*</span></label>
              <input
                type="email"
                id="{{ formId }}-email"
                name="contact[email]"
                autocorrect="off"
                autocapitalize="off"
                value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}"
                aria-required="true"
                {%- if form.errors contains 'email' -%}
                  class="input--error"
                  aria-invalid="true"
                  aria-describedby="{{ formId }}-email-error"
                {%- endif -%}
                >
              {%- if form.errors contains 'email' -%}
                <span id="{{ formId}}-email-error" class="input-error-message">
                  <span class="visually-hidden">{{ 'general.accessibility.error' | t }} </span>
                  {% include 'icon-error' %}
                  <span>{{ form.errors.translated_fields['email'] | capitalize }} {{ form.errors.messages['email'] }}.</span>
                </span>
              {%- endif -%}
            </div>
          </div>

          <label for="{{ formId }}-phone">{{ 'contact.form.phone' | t }}</label>
          <input type="tel" id="{{ formId }}-phone" name="contact[{{ 'contact.form.phone' | t }}]" pattern="[0-9\-]*" value="{% if form[phone] %}{{ form[phone] }}{% elsif customer %}{{ customer.phone }}{% endif %}">

    	  <label for="ContactFormDiscountCode">Discount Code</label>
		  <input type="text" id="ContactFormDiscountCode" name="Discount Code[Promo Code]" placeholder="">
    	  <input type="hidden" name="contact[Product Title]" value="{{ product.title }}">
		  <input type="hidden" name="contact[Product Url]" value="{{ shop.url }}{{ product.url }}">
    	  <input type="hidden" name="contact[Discount Code]" id ="ContactFormDiscountCode"
          <label for="{{ formId }}-message">{{ 'contact.form.message' | t }}</label>
          <textarea rows="10" id="{{ formId }}-message" name="contact[{{ 'contact.form.message' | t }}]">{% if form.body %}{{ form.body }}{% endif %}</textarea>
		  <input type="submit" class="btn" value="{{ 'contact.form.submit' | t }}">
     {% endform %}
{% endif %}

Thank in advance

0 Likes
Highlighted
Shopify Partner
60 6 15

Such a helpful forum, huh. I happened across this as I was having a similar issue, and thought I'd break tradition and actually post the answer here.

try changing 

<label for="ContactFormDiscountCode">Discount Code</label>
		  <input type="text" id="ContactFormDiscountCode" name="Discount Code[Promo Code]" placeholder="">

to 

<label for="ContactFormDiscountCode">Discount Code</label>
		  <input type="text" id="ContactFormDiscountCode" name="contact[DiscountCode]" placeholder="">

 

0 Likes