"Submit" button in product page form does not send message, add product to cart instead

Hello mates.

For more than a year we had a small code working within the product page, a subscription form for the customer to write down their email so he will be notified when a sold out product is restocked again. This form sent us an email with the following data: the email that the client had written down, product name and product id. Once we received this email, we externally processed this request on our own. It worked perfectly while we kept on Prestige theme 4.11.0.

We have recently updated the Prestige theme to version 5.7.0 and this code no longer works. The form “submit” button does not send the message anymore, but also when clicked product is added to cart and the user is redirected to cart page. We have not been able to locate how to fix it.

Find attached the form code.

{% unless product.available %}
  
    {% form 'contact' %}
	  {% if form.posted_successfully? %}
		

¡Tomamos nota! Te avisaremos cuando vuelva a estar disponible.

	  {% else %}
		{% if form.errors %}
		  

Por favor, introduce una dirección de correo electrónico válida.

		{% else %}
		  

¿Quieres que te avisemos cuando vuelva a estar disponible?

		{% endif %}
	  {% endif %}
	  {% unless form.posted_successfully? %}
		
		  {% if customer %}
			
		  {% else %}
			
		  {% endif %}
		  
		  
		  

            
          

        

	  {% endunless %}
	{% endform %}
  

{% endunless %}

Is there someone who could give us some light about this issue?

Thank you in advance

Gerard

Hi @acid-data ,

Please send your site and if your site is password protected, please send me the password. I will check it.

Good afternoon @LitExtension .

Thank you for your reply.

The site is https://lacremeorganics.com and is live so without password.

For the moment I’ve limited the snippet only for the following product in order to not bother our customers experience.

https://lacremeorganics.com/products/savon-n-2-triangle-jabon-solido-artesano

You’ll find the snippet below the “Sold out” message box.

Regards

Gerard

Hi @acid-data ,

I checked and the form cart is wrapped outside the contact form, so it won’t work. Please send me the code of the whole file, I will edit it for you.

Good morning @LitExtension .

Following your explanation I’ve checked the code by myself and I’ve found clearly what you suggested, so I’ve been able to modify it. Now it works like a charm!

You rock!

Thank you very much.

Gerard

1 Like

Hi @LitExtension ! I am having the same problem. Can you help me? Here’s the code:

{{ page.title }}

{{- page.content -}}

{%- form ‘contact’, class: ‘Form Form–spacingTight’ -%}
{%- if form.posted_successfully? -%}

{{ 'contact.form.successfully_sent' | t }}

{%- endif -%}

{%- if form.errors -%}

    {%- for field in form.errors -%} {%- if field == 'form' -%}
  • {{ form.errors.messages[field] }}
  • {%- else -%}
  • {{ form.errors.translated_fields[field] }} {{ form.errors.messages[field] }}
  • {%- endif -%} {%- endfor -%}
{%- endif -%}
{{ 'contact.form.name' | t }}
{{ 'contact.form.email' | t }} *
Contact Number *
Delivery Suburban *
Post Code *

*All fields are compulsory fields and must be answered.

I understand that it is available in Melbourne Metro only. * {{ 'contact.form.submit' | t }}

or Return to Store

{%- endform -%}

{% schema %}
{
“name”: “Contact page”,
“settings”: ,
“blocks”: [
{
“type”: “text”,
“name”: “Text field”,
“settings”: [
{
“type”: “text”,
“id”: “title”,
“label”: “Name”,
“default”: “Custom field”
},
{
“type”: “checkbox”,
“id”: “use_long_text”,
“label”: “Use long text”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “is_required”,
“label”: “Field is required”,
“default”: false
}
]
},
{
“type”: “dropdown”,
“name”: “Dropdown”,
“settings”: [
{
“type”: “text”,
“id”: “title”,
“label”: “Name”,
“default”: “Custom field”
},
{
“type”: “text”,
“id”: “values”,
“label”: “Values”,
“info”: “Separate each value by a comma.”,
“default”: “value 1, value 2, value 3”
}
]
}
],
“default”: {
“blocks”: [
{
“type”: “text”,
“settings”: {
“title”: “Your phone (optional)”
}
}
]
}
}
{% endschema %}