Newsletter popup still showing after customer puts their email

New Member
4 0 0

Hey everyone,

 

So, as the title says, my newsletter popup won't disappear even if the customer entered their email.

The process is this: someone enters on my website, the popup appears.

If the customer closes the popup, the next time he refreshes the web page, the popup appears again. If the customer puts their email and click subscribe, the popup closes and a message appears like in the image below (just like I want).

But when he refreshes the page, the popup is again appearing. I don't want the popup to appear if the customer already subscribed.

email.PNG

 

Thank you !

0 Likes
Shopify Staff
Shopify Staff
273 29 52

Hey @!

 

Cal here from Shopify, thanks for reaching out to us. In order for the Community to assist here, we will need a little more information about the popups. Is this being delivered by an app? Is it a newsletter popup built into a theme? What theme? Can we have a link to the store to observe the behavior? 

 

Thanks! 

Cal | Social Care @ Shopify

 - Was my reply helpful? Click Like to let me know! 

 - Was your question answered? Mark it as an Accepted Solution
 

To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
New Member
4 0 0

Yeah sure;

 

So, the popup is built into the theme called Amely.

I'll put below the code from the popup

 

{% if settings.newsletter_popup_enable %}
<div class="gp-popup newsletter-popup {% if settings.newsletter_popup_enable_test_mode %}test-mode{% endif %} {% if settings.newsletter_popup_display_on_mobile %}show-on-mobile{% endif %}" id="newsletter-popup" style="width: {% if settings.newsletter_popup_width != blank %}{{ settings.newsletter_popup_width }}px{% else %}500px{% endif %}; {% if settings.newsletter_popup_mobile_background_image != blank %}background-image: url({{ settings.newsletter_popup_mobile_background_image | img_url: 'master' }});{% endif %}">
<div class="newsletter-popup-inner {% if settings.newsletter_popup_mobile_background_image != blank %}has-mobile-banner{% endif %}" style="{% if settings.newsletter_popup_background_image != blank %}background-image: url({{ settings.newsletter_popup_background_image | img_url: 'master' }});{% endif %}">
<div class="block-popup-subscribe">
<div class="block-popup-top">
<div class="block-popup-content">
{% if settings.newsletter_popup_content != blank %}
<div class="block-popup-title">
{{ settings.newsletter_popup_content }}
</div>
{% endif %}

<div class="newsletter-popup-form inline-newsletter">
<div class="block newsletter">
<div class="content">
{% form 'customer', id: 'popup-newsletter' %}
<div class="input-group password__input-group">
<input type="hidden" name="contact[tags]" value="newsletter">
<input type="email"
name="contact[email]"
id="Email"
class="input-group__field newsletter__input input-large"
value="{% if customer %}{{ customer.email }}{% endif %}"
placeholder="{{ 'general.newsletter_form.email_placeholder' | t }}"
autocorrect="off"
autocapitalize="off" required>
<span class="input-group__btn">
<button type="submit" class="btn newsletter__submit" name="commit" id="Subscribe">{{ 'general.newsletter_form.submit' | t }}</button>
</span>
</div>
{% endform %}
</div>
</div>
</div>
<div class="checkbox field choice dont-show">
<input id="dont_show" type="checkbox">
<label for="dont_show">{{ 'general.newsletter_form.dont_show' | t }}</label>
</div>

</div>
</div>
</div>
<button title="Close (Esc)" type="button" class="mfp-close">×</button>
</div>
</div>

<script type="text/javascript">
function initPopupNewsletter() {
$(window).load(function () {
setTimeout(function() {
if ($('#newsletter-popup').hasClass('test-mode')) {
$.magnificPopup.open({
items: {
src: '#newsletter-popup'
},
type: 'inline',
mainClass: 'modal_newsletter_popup mfp-fade',
removalDelay: 300
});
} else {
if(getCookie('newsletterpopup') != 'nevershow'){
$.magnificPopup.open({
items: {
src: '#newsletter-popup'
},
type: 'inline',
mainClass: 'modal_newsletter_popup mfp-fade',
removalDelay: 300
});
}
}
}, {{ settings.newsletter_popup_delay_time | times: 1000 }});
});

$('#newsletter-popup #dont_show').click(function() {
dontShowPopup('dont_show');
});
}

function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
}
return "";
}

function dontShowPopup(el) {
if($('#'+el).prop('checked')) {
var d = new Date();
d.setTime(d.getTime() + (24*60*60*1000*30));
var expires = "expires="+d.toUTCString();
document.cookie = 'newsletterpopup' + "=" + 'nevershow' + "; " + expires;
} else {
document.cookie = 'newsletterpopup' + "= ''; -1";
}
}

$(document).ready(function() {
{% if settings.newsletter_popup_display_on_mobile %}
initPopupNewsletter();
{% else %}
if ($(window).width() > 767) {
initPopupNewsletter();
}
{% endif %}
});
</script>
{% endif %}

0 Likes
Shopify Staff
Shopify Staff
273 29 52

Have you run this past your theme developer? It could be an easy fix for them, as they would know their code inside out.

Cal | Social Care @ Shopify

 - Was my reply helpful? Click Like to let me know! 

 - Was your question answered? Mark it as an Accepted Solution
 

To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
New Member
4 0 0

No, I haven't. But yeah, I should get in touch with them

0 Likes