Why is my newsletter generating an error message?

Hello,

I have some problems with my newsletter. When I enter an email adress and then press the button, a new browser pops with an error.

Could you please advise on this issue?

Thank you

Hello @Sovel ,

Could you please share your website url here?

sure https://www.sovel.ro/

Hi @Sovel . Your newsletter signup code is not correct.

Your form action is empty.

Is it possible to share the code of files like newsletter.liquid or email-signup.liquid?

@Sovel . Your form action should be like this.

Hello,

Here is the code for home-lewsletter.liquid.

{%- if section.settings.reponsive_mt != blank -%}
{%- assign margin_top_responsive = section.settings.reponsive_mt | split: ‘,’ -%}
{% capture margin_top %}mt-{{ margin_top_responsive[0] }} mt-sm-{{ margin_top_responsive[1] }} mt-md-{{ margin_top_responsive[2] }} mt-lg-{{ margin_top_responsive[3] }} {% endcapture %}

{%- endif -%}
{%- if section.settings.reponsive_bt != blank -%}
{%- assign margin_bottom_responsive = section.settings.reponsive_bt | split: ‘,’ -%}
{% capture margin_bottom %}mb-{{ margin_bottom_responsive[0] }} mb-sm-{{ margin_bottom_responsive[1] }} mb-md-{{ margin_bottom_responsive[2] }} mb-lg-{{ margin_bottom_responsive[3] }} {% endcapture %}
{%- elsif section.settings.margin_bottom != blank -%}
{% capture margin_bottom %}margin-bottom-{{ section.settings.margin_bottom }}{% endcapture %}
{%- endif -%}

{% if section.settings.home_newsletter_title != blank %}

{{ section.settings.home_newsletter_title }}

{% if section.settings.home_newsletter_subtitle != blank %}

{{ section.settings.home_newsletter_subtitle }}

{% endif %}
{% endif %}

{% schema %}
{
“name”: “Newsletter”,
“class”: “index-section section”,
“settings”: [
{
“type”: “range”,
“id”: “margin_top”,
“min”: 0,
“max”: 100,
“step”: 1,
“unit”: “px”,
“label”: “Margin Top”,
“default”: 10
},
{
“type”: “text”,
“id”: “reponsive_mt”,
“label”: “Responsive Margin Top”,
“info”: “Example is ‘20,30,40,60’”
},
{
“type”: “range”,
“id”: “margin_bottom”,
“min”: 0,
“max”: 100,
“step”: 1,
“unit”: “px”,
“label”: “Margin Bottom”,
“default”: 10
},
{
“type”: “text”,
“id”: “reponsive_bt”,
“label”: “Responsive Margin Bottom”,
“info”: “Example is ‘20,30,40,60’”
},
{
“type”: “select”,
“id”: “layout_use”,
“label”: “Style:”,
“default”: “layout_1”,
“options”: [
{
“value”: “layout_1”,
“label”: “Style layout 1”
},
{
“value”: “layout_2”,
“label”: “Style layout 2”
}
]
},
{
“type”: “text”,
“id”: “home_newsletter_title”,
“label”: “Heading”,
“default”: “Newsletter”
},
{
“type”: “text”,
“id”: “home_newsletter_subtitle”,
“label”: “Subheading”,
“default”: "Subscribe now to get daily updates "
},
{
“type”: “text”,
“id”: “mailing_list_form_action”,
“label”: “MailChimp form action URL”,
“info”: “Where do I find my MailChimp form action URL?
}
],
“presets”: [
{
“name”: “Newsletter”,
“category”: “3) Builder”

}
]
}
{% endschema %}

{% stylesheet %}
{% endstylesheet %}

{% javascript %}
{% endjavascript %}

@Sovel . I think there are some errors in your code.

But if it is working in your side, then leave it at it is.

Just replace

with this line

{% form ‘customer’ %}

There are many issues. Like:

  1. Missing translations

  2. input field don’t have the necessary name field.

You can view the below code and update your code accordingly.

{% form 'customer', class: 'newsletter-form' %}
                
                

                  

                    
                    
                    
                  

                  {%- if form.errors -%}
                    <small>
                      {%- render 'icon-error' -%}
                      {{- form.errors.translated_fields.email | capitalize }}
                      {{ form.errors.messages.email -}}
                    </small>
                  {%- endif -%}
                

                {%- if form.posted_successfully? -%}
                  ### 
                    {% render 'icon-success' -%}
                    {{- 'newsletter.success' | t }}
                  
                {%- endif -%}
              {% endform %}

without the customer form and necessary name attributes of input fields, newsletter will not work

Let us know if you’ve any queries.

I dont get it. Its giving me errors over errors. Am i supposed to replace the whole line of form with the line you provided?

Yes you can try. If it stilling giving the error, share the code again pleas.

Hello,

Sorry for the late response. Its giving this error if I try to replace the code with the line your provided.

Also, there is another newsletter liquid called: newsletter-form.liquid. I attached the code for this code, maybe this is what causes the problem.

{% comment %}

MailChimp is the go-to newsletter service for Shopify.
Use the link below to find your MailChimp “form action”
and insert it in your site settings.

MailChimp newsletter integration and requirement:

{% endcomment %}