How to add Newsletter box to Magento header or footer


Newsletter subscribe box is a small box that allows users to subscribe for your news through email. This is a must-have function for any ecommerce store to collect target customers email for running email marketing campaign. Magento, of course includes Newsletter function to allow store owners to inform their customers about products news, promotion, discount…

In this Magento tutorial, we will go through how to put Newsletter subscribe box at any location you want on your website such as Footer, Header.

Add Newsletter subscribe box to Footer

To add Newsletter box to footer of Magento, open your magento hosting/server file manager or connect to FTP and navigate to app/design/frontend/default/theme_name/layout/newsletter.xml, edit newsletter.xml with a file editor and find the following code

Here you can see name of footer block to call in  name="footer.newsletter"

Next, navigate to app/design/frontend/default/your_theme/template/page/html/footer.phtml, edit and add this line:

And it will look like this

add newsletter to magento 1

Save your changes and refresh homepage to see the newsletter subscribe box at footer

add newsletter to magento 2

Add Newsletter subscribe box to Header

Similarly to footer, open app/design/frontend/default/theme_name/layout/newsletter.xml to find the name of block to call, you can change it to header.newsletter to better organize code like this

Next, go to app/design/frontend/default/your_theme/template/page/html/header.phtml, edit and add this line

Save change and you will see newsletter box appears on header of your siteadd newsletter to magento header

Add Newsletter subscribe box to anywhere in your design

More quickly, you can use the following line code to add to any where you want on your template (normally phtml file)

Add newsletter box using Magento backend

If you don’t want to touch core file of Magento or you don’t have access to file you can use the following step to add newsletter box to your theme

Step 1

Login to backend and go to CMS > Static Blocks > Add new

Set value for Block Title, Identifier , and make sure Status is enabled then add this line to content section

add newsletter to magento 4

Save block

Step 2

Go to CMS > “Pages” or “Static Blocks”, depend on where you want to insert newsletter box, edit that page/static block and in content section add this code

With block_identifier  as the Identifier we set in Step 1.

Save change to see the result

Show newsletter even when customer logged in

Sometimes when working with Magento, some of my clients have their Magento site hide Newsletter subscribe form when customers logged in, how to get rid of this?

Go to app/design/frontend/default/theme_name/layout/newsletter.xml and look for the following code

Remove or comment this line and save change.

Now customer will see the newsletter box even when they are signed in.

Hope you find this tutorial helpful, enjoy coding!

Rate this post


About Author

Daniel is a Magento developer with 5 years of experience with customizing Magento extensions, Magento templates. He's main author at Magento explorer

Leave A Reply