We use cookies to make your experience better. To comply with the new e-Privacy directive, we need to ask for your consent to set the cookies. Learn more.
- Home
- Blog
- eCommerce Talk
- How to Disable Welcome Email in Magento 2 After Creating New Customer
How to Disable Welcome Email in Magento 2 After Creating New Customer
A welcome email is the best way to put an impression in customer’s minds when they visit your website or store for the first time and make a purchase, subscribe to the blog or newsletter via registering their email address.
In Magento 2, you get the functionality to send welcome emails to newly registered customers or subscribers. Not only that, but it will also send welcome emails if the store owner creates a new entry or adds a new customer from the admin panel.
In these cases, sending welcome emails to customers is good for a company. But, in some cases, it would not be good to send welcome emails.
Let’s say, you are turning your store to the Magento 2 CMS platform from any other CMS platform. Sending welcome emails and telling customers to register them again in the same store won’t be good then.
In that case, you have to create these customers at the backend from the admin panel. Otherwise, it will have a bad impression if customers get welcome emails again and again.
If you already are sending welcome emails using a third-party customer engagement system and want to skip the default welcome email sent by Magento or if you are using a custom template for the default welcome email, the best thing to do is just disable the default Magento 2 welcome email sent while making a new entry/adding a new customer in the store.
If they are the case, you would probably like to disable the default welcome email once you add a new customer in Magento 2 from the admin.
To overcome such problems, we as- MagesSpark have come with a programmatic solution that will help you disable the welcome email after letting you add a new customer from the admin panel in Magento 2.
Way to Disable Welcome Email After Creating New Customer From Admin in Magento 2
Step 1: Use the code below in the di.xml file at app/code/MageSpark/DisableAdminNotification/etc/adminhtml
<?xml version="1.0" encoding="utf-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="\Magento\Customer\Model\EmailNotification">
<plugin name="magespark-disable-admin-email-notification" type="MageSpark\DisableAdminNotification\Plugin\EmailNotification" sortOrder="1"/>
</type>
</config>
Step 2: Use the code below in the EmailNotification.php file at app/code/MageSpark/DisableAdminNotification/Plugin
<?php
declare(strict_types=1);
namespace MageSpark\DisableAdminNotification\Plugin;
use Magento\Customer\Model\EmailNotification;
class DisableNotification{
/**
* Disable admin Email notifications
*
* @param EmailNotification $subject
* @param \Closure $proceed
* @return EmailNotification
*/
public function aroundNewAccount(
EmailNotification $subject,
\Closure $proceed
) {
return $subject;
}
}
Note: You must have to use the di.xml file stored in the adminhtml because emails would only be disabled if you add or create a new customer from the admin panel.
And that’s it!
If you face any problems or have any questions about this post, feel free to mention them below in the comment section. We’d love to help.
Don’t forget to share our programmatic solution with Magento Community via social media.
Thank you!