No error message when user subscribes a newsletter with an already registered email

Solved

No error message when user subscribes a newsletter with an already registered email

luigi-ib
Shopify Partner
19 0 7

Hi Shopify community,

 

I'm creating a landing page having a form with inputs for first name, last name and email. When a new user fills and submits the form, it should be created a new Shopify customer by using these info.

My Shopify store uses the official Dawn theme, without any vendor customization. I implemented the form by using the theme tag "form" in this way:

{% form 'customer', return_to: '/pages/newsletter-thank-you-page' %}
    <input name="contact[first_name]" value="{{ form.first_name }}">
    <input name="contact[last_name]" value="{{ form.last_name }}">
    <input name="contact[email]" value="{{ form.email }}">
    <button type="submit" class="button" name="commit">Registrati</button>
{% endform %}

When the user submits the form successfully for the first time, a new Shopify customer with above info is created as expected. The problem happens when the user submits the form with an already registred email. In that case, after the submit, he is redirected to the same page and there are no errors in Liquid object "form.errors(but the Liquid object "form.posted_successfully?" is false). I already tried to remove the "return_to" parameter from the tag "form", but the problem remains the same.

 

Do you have any idea of the cause of this problem? And how can I show to the user an error message like "This email address has been already taken"?

Accepted Solution (1)
Claud9
Shopify Partner
8 1 2

This is an accepted solution.

Ciao Luigi,
I found this workaround. It's not the perfect solution, it's in Javascript, but it works.

Newsletter Language for Already Subscribed Users - Shopify Community

View solution in original post

Replies 8 (8)

luigi-ib
Shopify Partner
19 0 7

Anyone? Shopify staff?

Egloo
Shopify Partner
13 3 8

Hi!
Did you manage to find a solution for this problem?
2 years later, and no theme has added this functionality. And cant find a way to add it.

Thanks!

If helpful then please Like and Accept Solution.

EGLOO™ is LCdM's Shopify department, with full concentration in developing Shopify stores to help merchants sell.
Need a partner to help you modify or customize your store?
We are HERE to help.
Email: hola@egloo.es


luigi-ib
Shopify Partner
19 0 7

Hi,

 

I didn't find any solution. Right now I manage this by showing a general error.

Claud9
Shopify Partner
8 1 2

This is an accepted solution.

Ciao Luigi,
I found this workaround. It's not the perfect solution, it's in Javascript, but it works.

Newsletter Language for Already Subscribed Users - Shopify Community

luigi-ib
Shopify Partner
19 0 7

Ciao @Claud9,

 

thanks for this workaround 🙏

 

I'll use it until the Shopify team provides a solution to handle this case.

avaskye
Excursionist
36 0 7

Hi @Claud9 Were you able to find a solution to this by any chance besides the workaround? I tried to implement the workaround but I couldn't find global.js in my code settings. 

Claud9
Shopify Partner
8 1 2

Hi @avaskye, depending on the theme you are using, the javascript filename that you need to edit changes.

Open your theme.liquid file and seach for something like  "<script src="{{ 'YOURFILENAME.js' | asset_url }}" defer="defer"></script>

Now, 

'YOURFILENAME is the name of the file you need to edit. You can append the snippet at the end of the .js file. 

 

avaskye
Excursionist
36 0 7

Hi @Egloo did you happen to find a solution for this by any chance? I still haven't figured out how to do this for my Dawn theme. Thanks in advance!