I have multiple store view setup in my Magento 2 store.
Now I want to disable welcome email for the user that register from the wholesale store. I am trying this solution but it stops sending email to all user.
https://magento.stackexchange.com/a/174419
I am not getting how to do this for the specific store.
Update
I am trying following code
<?php
namespace Company\Module\Model\Plugin;
class EmailNotification extends \Magento\Customer\Model\EmailNotification {
public function aroundNewAccount(
\Magento\Customer\Model\EmailNotification $subject,
\Closure $proceed,
\Magento\Customer\Api\Data\CustomerInterface $customer,
$type,
$backUrl = '',
$storeId = 0,
$sendemailStoreId = null
) {
if($sendemailStoreId == 1){
return false;
}
/*$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$_storeManager = $_objectManager->get('Magento\Store\Model\StoreManager');
if($_storeManager->getStore()->getWebsiteId() == 1){
return false;
}*/
$result = $proceed($customer ,$type ,$backUrl ,$storeId ,$sendemailStoreId);
return $result;
}
}
?>
And getting error We can't save the customer.
Thanks,