cancel
Showing results for 
Search instead for 
Did you mean: 

Turn Off Customer Welcome Email?

SOLVED

Turn Off Customer Welcome Email?

Is it possible to turn off the initial Welcome Email for a customer who signs up on the site in 2.4?

 

If this is not possible in a standard 2.4 site, is there an extension that can do this?

 

We've got customers who have complained about extra emails (yes, even these "Welcome to our site" emails) and we'd like to turn it off if possible, but I don't see a configuration option for this.

 

TIA.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Turn Off Customer Welcome Email?

Hello @SJ_Med ,


Have tried the below links?
https://magento.stackexchange.com/a/265435/72475 

For specific store 
https://magento.stackexchange.com/a/221986/72475 

 

For newsletter, email try the following extension 

https://github.com/metagento/magento-2-disable-newsletter-success-email

https://www.metagento.com/blog/magento-2-disable-newsletter-subscription-success-email


Hope this will help you 
Problem solved? Click Kudos and "Accept as Solution" 
Thank you.

View solution in original post

10 REPLIES 10

Re: Turn Off Customer Welcome Email?

@SJ_Med 

1. Use the below code in the di.xml file at app/code/Vendore/Extension/etc/

 

<?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="disable-email-notification" type="Vendore\Extension\Plugin\EmailNotification" sortOrder="1"/>
    </type>

</config>

2. Use the below code in the EmailNotification.php file at app/code/Vendore/Extension/Plugin

<?php

namespace Vendore\Extension\Plugin;
class EmailNotification
{
    public function aroundNewAccount(\Magento\Customer\Model\EmailNotification $subject, \Closure $proceed)
    {
        return $subject;
    }
}

 

 
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Turn Off Customer Welcome Email?

Thank you Sanjay! I'll give this a try and report back. I really appreciate this!

Re: Turn Off Customer Welcome Email?

I tried this but perhaps I'm missing something - used code exactly as s pulled, in the correct spots, but Acount and newsletter confirmation were still sent.

 

Any ideas?

Re: Turn Off Customer Welcome Email?

@SJ_Med 

Only welcome email can be disabled with this code.

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Turn Off Customer Welcome Email?

Hi Sanjay,

 

So:

1. There's no way to turn off the Newsletter email? Perhaps with other extensions, etc?

2. Any idea what I'm doing wrong with the code? Placed exactly as is (cut and paste to ensure correctness) and in the specified place. When I created an account, it still emailed me....

 

Thanks.

Re: Turn Off Customer Welcome Email?

Hello @SJ_Med ,


Have tried the below links?
https://magento.stackexchange.com/a/265435/72475 

For specific store 
https://magento.stackexchange.com/a/221986/72475 

 

For newsletter, email try the following extension 

https://github.com/metagento/magento-2-disable-newsletter-success-email

https://www.metagento.com/blog/magento-2-disable-newsletter-subscription-success-email


Hope this will help you 
Problem solved? Click Kudos and "Accept as Solution" 
Thank you.

Re: Turn Off Customer Welcome Email?

Thank you Smita. I'll check those out!

Re: Turn Off Customer Welcome Email?

@Sanjay Jethva @SJ_Med i want to enable/disable this from admin configuration, what changes do we need to update on the plugin code ?

<?php

namespace Vendor\modulename\Plugin\Magento\Customer\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;

class EmailNotification
{
    
	public function __construct(
		ScopeConfigInterface $scopeConfig
	) { 
		$this->_scopeConfig = $scopeConfig;
	}
  
    public function aroundNewAccount(
        \Magento\Customer\Model\EmailNotification $subject,
        \Closure $proceed,
        $type = 'registered',
        $sendemailStoreId = null,
        $backUrl = '',
        $customer,
        $storeId = 0
    ) {

        if( $type === null ) {
            $type = $subject::NEW_ACCOUNT_EMAIL_REGISTERED;
        }
		
		$isEnabled = $this->_scopeConfig->getValue('customer/create_account/disable_welcome_email', ScopeInterface::SCOPE_STORE);

        if(!$isEnabled){
			$result = $proceed($type, $sendemailStoreId, $backUrl, $customer, $storeId);
			return $result;
        }
		
    }
}

currently what happening is i am able to enable/disable this from admin, but when $isEnabled is True, We can save the customer. But customer details not shown on backend. Its like there is no customer,but when we create the same customer,is says customer already created.  

Re: Turn Off Customer Welcome Email?


@rejithterr65af wrote:

@Sanjay Jethva @SJ_Med i want to enable/disable this from admin configuration, what changes do we need to update on the plugin code ?

<?php

namespace Vendor\modulename\Plugin\Magento\Customer\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;

class EmailNotification
{
    
	public function __construct(
		ScopeConfigInterface $scopeConfig
	) { 
		$this->_scopeConfig = $scopeConfig;
	}
  
    public function aroundNewAccount(
        \Magento\Customer\Model\EmailNotification $subject,
        \Closure $proceed,
        $type = 'registered',
        $sendemailStoreId = null,
        $backUrl = '',
        $customer,
        $storeId = 0
    ) {

        if( $type === null ) {
            $type = $subject::NEW_ACCOUNT_EMAIL_REGISTERED;
        }
		
		$isEnabled = $this->_scopeConfig->getValue('customer/create_account/disable_welcome_email', ScopeInterface::SCOPE_STORE);

        if(!$isEnabled){
			$result = $proceed($type, $sendemailStoreId, $backUrl, $customer, $storeId);
			return $result;
        }
		
    }
}

currently what happening is i am able to enable/disable this from admin, but when $isEnabled is True, We can save the customer. But customer details not shown on backend. Its like there is no customer,but when we create the same customer,is says customer already created.  


Thanks for help.