Save phones number for customers

Headz0r
New Member
1 0 0

I'm trying to save phone numbers in my customers with a form:

{%- assign newsletter_form_id = 'signup2-' | append: section_id -%}
{% form 'customer', id: newsletter_form_id %}
  {%- if form.posted_successfully? -%}
    <div class="note note--success">
      {{ 'general.newsletter_form.newsletter_confirmation' | t }}
    </div>
  {%- endif -%}
  {{ form.errors | default_errors }}

  {%- unless form.posted_successfully? -%}
    <input type="hidden" name="contact[tags]" value="prospect,sms">
    <input type="hidden" name="contact[context]" value="{{ snippet_context }}">

    <div class="newsletter-form-group">

        <div class="outer-text-box" id="tel-box">
        	<input type="tel" id="tel" 
                   name="contact[phone]"
                   class="cool-text-box"
                   placeholder="Enter your phone number"
                   autocorrect="off"
      			   autocapitalize="off"
                   autocomplete="tel"
                   pattern="(+)*[0-9\-]*" 
                   value="{% if form.phone %}{{ form.phone }}{% elsif customer %}{{ customer.phone }}{% endif %}"
      				></input>
        </div>
        <div style="margin: auto; text-align: center;">
        <button class="lit-button" id="tel-button">Sign up</button><br>
		</div>
	</div>
  {%- endunless -%}
{% endform %}

 

Now I'am not sure. I don't get an error when submitting the form. I tried with the name="contact[email]" property on the input field and that seemed to work.

Questions:
How can I go about debugging this?

Is it even possible to solely save the contact[phone] property?

 

0 Likes