How can I modify this code to use phone number instead of email?

arkenciel
Tourist
12 0 4

 

Hello, I have developed this code but I am not sure how to change it without losing functionality. I am trying to make it so that instead of email, it uses phone number. Any help would be appreciated.

This is the code:

 

{% unless product.available %}
<div id="sold-out">
{% form 'contact' %}
{% if form.posted_successfully? %}
<p class="accent-text"> Te notificaremos cuando este producto este disponible.</p>
{% else %}
<p> Click <a id="notify-me" href="#"><strong>aqui</strong></a> para ser notificado cuando {{ product.title }} este disponible.</p>
{% endif %}
{% if form.errors %}
<div class="error feedback accent-text">
<p>Por favor da una direccion de correo electronico valida.</p>
</div>
{% endif %}
{% unless form.posted_successfully? %}
<div id="notify-me-wrapper" class="clearfix" style="display:none">
{% if customer %}
<input type="hidden" name="contact[email]" value="{{ customer.email }}" />
{% else %}
<input style="float:left; width:180px;" required="required" type="email" name="contact[email]" placeholder="tu@email.com" class="styled-input{% if form.errors contains 'email' %} error{% endif %}" value="{{ contact.fields.email }}" />
{% endif %}
<input type="hidden" name="contact[body]" value="Please notify me when {{ product.title | escape }} becomes available." />
<input style="float:left; margin-left:5px;" class="btn styled-submit" type="submit" value="ENVIAR" />
</div>
{% endunless %}
{% endform %}
</div> <br/>
{% endunless %}

Replies 2 (2)

tim
Shopify Expert
3488 284 1295

This type of form requires e-mail input.

https://shopify.dev/docs/themes/customer-engagement/add-contact-form#required-input 

 

Potentially you can add phone number input and add some dummy e-mail input value as a workaround if you want to hide the e0mail input.

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
arkenciel
Tourist
12 0 4

thanks for the feedback