Question

How can we stop new order confirmation email.

We have 3 payment methods which are EFT(Cash on Delivery), Paypal express checkout & Credit card payment. So when we place an order we get invoice and order confirmation email, so our requirement is something like we don't want order confirmation email if Paypal express checkout is used to order otherwise we want them so can't disable it from admin config and want some custom solution about it, any help will be appreciated, Thanks.

Was it helpful?

Solution

You can either create around plugin or preference for the "send" function available in this file

vendor/magento/module-sales/Model/Order/Email/Sender/OrderSender.php

You can put your respective business logic in this function to restrict sending order confirmation emails in specific cases.

Hope this help you.

Thanks,

OTHER TIPS

simply Override Magento\Sales\Model\Order\Email\Sender.php

 if($order->getPayment()->getMethodInstance()->getCode() != "yourpaymentmethodcode"){
        $sender->send();
 }
 if($order->getPayment()->getMethodInstance()->getCode() != "yourpaymentmethodcode"){
        $sender->sendCopyTo();
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top