Make Newsletter checked by default in Magento

So when shopping online, you may notice that when you purchase items or register an account, most of the time you will have an option to sign up to their mailing list. By default, these are normally set to subscribe by default.

Magento for some reason, won’t have this set to subscribe users by default, the checkbox is unticked.

While working on a client site who needed the newsletter to be auto-checked, this little snippet came in handy:

If you want the newsletter opt in on the customer account registration page checked by default, locate this file: /app/design/frontend/<YOUR-THEME>/default/template/customer/form/regist‌​er.phtml

Find this line:

<?php if ($this->isNewsletterEnabled()): ?>

Right below this line, add this:

<?php
$checked = true;
if($this->getFormData()->getEmail()) {
if(!$this->getFormData()->getIsSubscribed()) {
$checked = true;
}
}
?>

A little below that, you’ll see this div:

<div class="input-box">

Replace the input’s code in the div with this:

<input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed" checked="checked" class="checkbox" />

Save the file and you’re good to go!

Useful post? Share it

7 comments on “Make Newsletter checked by default in Magento

  1. When I try to go to – /app/design/frontend//default/template/customer/form/regist‌​er.phtml (after frontend there are 2 //) I guess template means my template name? Not sure, but I thought that maybe that is what is menat. So I select it but there is not a “customer” folder. So do I need to add the folder/file structure or does this mean that my template is using the default folders and files?

    1. Hi Neal, if your Magento install uses a custom theme, you can find the register.phtml file in the same location (but in your theme file). If you do, this will be overwriting the default folder and files. If there is no file or folder in your current theme, then your Magento will be using the default theme.

      Regarding the double // in the URL, this is probably an additional ‘/’ added somewhere.

      1. Regarding the double // in the URL, this is probably an additional ‘/’ added somewhere…
        This double // I am referring to is in your example.

        1. So it is. It was stripped in the WordPress editor. I’ve wrapped it now in code tags so now appears correctly. It should be your custom theme folder inside that path.

          Thanks for the spot 😉

  2. Hi Phil,

    I follow you steps in this tutorials & I clear all cache of magento site. but no luck the checkbox is still uncheck. btw I’m using magento 1.18 version. do you have a tips for me? thanks..

  3. For me only works when i edit and put code on
    /app/design/frontend/MY TEMPLATE/default/template/persistent/customer/form/register.phtml

    Magento V1.9.1.0

Leave a Reply

Your email address will not be published.