I have a Magento 2.2.4 store with the B2B extension installed.

I am looking to disable some of the emails for which you can set templates in

Stores > Configuration > Customers > Company Configuration

How can I add an admin setting to disable the sending of these emails like you see in the

Sales > Sales Emails settings

1 Answer 1


To disable certain B2B emails:

  1. Add a preference to your module's Vendor\Module\etc\di.xml file to extend the class responsible for sending B2B emails like:
    <preference for="Magento\Company\Model\Email\Sender" type="Vendor\Module\Model\Email\SenderOverride" />
  1. In Vendor\Module\Model\Email\SenderOverride, Override the function that sends the email like:
    public function sendAssignSuperUserNotificationEmail(CustomerInterface $customer, $companyId)
        // don't send email
        return $this;

If you desire to have this functionality controlled by an admin setting, then you will need to create the following files and lookup the setting in "Vendor\Module\Model\Email\SenderOverride"

  • Vendor\Module\etc\adminhtml\system.xml
  • Vendor\Module\etc\config.xml

Please reference the Adobe Experience League docs for more info on these files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.