Adding Magento’s Newsletter Signup Module to a CMS Page
As a senior developer at Laravel Company, I frequently receive requests for integrating Magento’s built-in newsletter signup functionality into custom CMS pages. This module allows you to collect customer emails right from your website and engage with them through targeted campaigns.
In this post, I’ll guide you step-by-step on how to add the default Magento newsletter signup form to a CMS page using only core features and without any third-party extensions.
Understanding the Newsletter Signup Module
The Newsletter module in Magento comes pre-installed and allows customers to subscribe or unsubscribe from your newsletter. It manages the subscription process, stores subscribers’ data, and provides basic reporting functionalities out of the box.
To access this feature, navigate to Stores > Settings > Configuration > Customers > Customer Configuration > Newsletters. Here you can enable/disable the module, set up auto-subscription options, and configure welcome emails.
Preparing Your CMS Page
Before we proceed, make sure your Magento CMS page is ready for content insertion. If not, create a new static block using Content > Elements > Blocks > Add New Block. Give it an identifier (like newsletter-signup-block) and save the changes.
Inserting the Newsletter Form into Your CMS Page
To add the newsletter signup form to your CMS page:
- Go to Content > Pages or Content > Static Blocks, depending on where you want to place the form.
- Click Add New Page or Edit Existing Page if you already have a page ready.
- In the content editor, find the area where you want the form to appear (usually the main content field).
- Instead of typing free-form HTML, click on the Source button to switch to raw HTML mode.
Adding the Newsletter Signup Code
In the source code editor, you can now directly insert the newsletter signup code provided by Magento:
{{block type="newsletter/subscribe" name="newsletter_subscribe" as="newsletter"}}
This single line of code includes the entire newsletter subscription block with all required JavaScript and CSS files.
Configuring the Newsletter Form
The name attribute corresponds to the block’s identifier, while the as attribute creates a block alias (newsletter) that you can use for further customization if needed. This configuration ensures the form renders correctly within your page layout.
Remember: Magento automatically includes necessary CSS and JavaScript files required by this block. You don’t need to manually include them in your theme’s page layouts or templates.
Saving Your Changes
Once you’ve added the newsletter signup code, click “Save Page” (or “Save Block”) depending on where you made the changes. The form will now appear on your live Magento store at the specified location.
Testing and Reviewing Subscriptions
To verify that everything works correctly:
- Visit your frontend website.
- Locate the newsletter signup block you just added to a CMS page or static block.
- Enter a valid email address for testing purposes.
- Click “Subscribe” to submit the form.
After successful submission, Magento will send an automatic subscription confirmation email to the provided address. Remember that these emails are configured in the Newsletter module settings (Stores > Settings > Configuration > Customers > Customer Configuration > Newsletters).
Conclusion
Adding Magento’s default newsletter signup module to a CMS page is straightforward when you leverage the built-in functionality of the Newsletter extension. By following this guide, you can easily collect customer email addresses without resorting to third-party extensions or custom development.
At Laravel Company, we specialize in helping businesses like yours harness the power of open-source e-commerce platforms like Magento to drive growth and engagement through effective email marketing strategies. If you need further assistance with Magento development or want to discuss advanced newsletter integration options, feel free to reach out!