Personalized checkout and custom promotions with Shopify Scripts
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 %}
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.
thanks for the feedback
We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024