Adding newsletter checkbox to Magento (1.4.1.1) one page checkout

Adding newsletter checkbox to Magento (1.4.1.1) one page checkout

September 28, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Adding newsletter checkbox to Magento (1.4.1.1) one page checkout

Adding Newsletter Checkbox to Magento (1.4.1.1) One Page Checkout

Hello! I understand you’re new to Magento development and need help adding a newsletter subscribe checkbox to the one page checkout process in version 1.4.1.1. Let’s break down this task step-by-step.

Understanding Your Current Setup

You’ve already done some great work:

  • You have a newsletter subscribe module that observes the checkout_type_onepage_save_order event.
  • When an order is saved, it checks if there’s a logged-in customer and subscribes them to the newsletter. If not, it uses the email provided during checkout.

The key challenge now is to add logic to only trigger this subscription when the customer actually ticks the newsletter checkbox in the checkout process.

Where Are We Going Wrong?

The issue lies in how you’re currently handling the event observation. You’re subscribing every customer who visits the checkout, regardless of their preference for the newsletter. This isn’t user-friendly and could lead to unwanted subscriptions.

How to Fix This: Observing Checkbox State

To solve this, we need to modify your observer to check if the newsletter checkbox was ticked before triggering the subscription process.

Step 1: Add a Hidden Input Field for the Checkbox

In your one page checkout template (usually located in app/design/frontend/base/default/template/checkout/onepage/billing.phtml), add a hidden input field next to your newsletter checkbox:

<input type="hidden" name="newsletter_subscribe" id="newsletter_subscribe">
<div class="checkbox">
    <input type="checkbox" name="newsletter_subscribe" value="1" id="newsletter_subscribe_checkbox" />
    <label for="newsletter_subscribe_checkbox">Sign up for our newsletter.</label>
</div>

This field will store the state of the checkbox.

Step 2: Update Your Observer

Modify your observer class to check if the hidden input field is set:

public function list_subscribe(Varien_Event_Observer $observer)
{
    $quote = $observer->getEvent()->getQuote();
    $customer = $quote->getCustomer();

    // Check if the newsletter subscribe field is set to 1 (ticked)
    if ($quote->getNewsletterSubscribe() && (($customer instanceof Mage_Customer_Model_Customer))) {
        Mage::getModel('newsletter/subscriber')->subscribeCustomer($customer);
    }
}

In this code:

  • We retrieve the value of the newsletter_subscribe field from the quote object using getNewsletterSubscribe().
  • The method returns 1 if the checkbox was ticked, and an empty string otherwise.

This update ensures that a customer is only subscribed to the newsletter when they explicitly tick the box during checkout.

Conclusion

Adding a newsletter subscribe checkbox to a Magento one page checkout involves modifying your event observer to check for user input before triggering the subscription process. By adding a hidden input field alongside your checkbox and updating your observer logic, you can ensure that customers are only subscribed if they actively choose to do so.

Remember, it’s crucial to respect customer privacy and preferences in any newsletter implementation. Always make sure you have clear opt-in mechanisms and comply with relevant regulations like GDPR or CAN-SPAM.

If you found this guide helpful, consider exploring our other Magento tutorials at Laravel Company. We provide comprehensive resources for developers looking to master the Magento platform.

Checkout Extensions Themes Email

Our network