cancel
Showing results for 
Search instead for 
Did you mean: 

Stop order email confirmation to customer only Magento 2.3.4

Stop order email confirmation to customer only Magento 2.3.4

Hi, I am on Magento community version 2.3.4, and my store is connected to Mailchimp.

 

I like to use Mailchimp order confirmation email instead of Magento sales email. I created the email in Mailchimp and it is working fine.  However, since I have disabled my order confirmation notification in Magento to avoid  customers receiving duplicate emails, I don't know when I have a new order!

 

I checked Mailchimp configuration page, and as far as I can tell, they don't notify the store owner. They only send confirmation emails to customer. And Magento stopped sending order configuration emails to me, since I have disabled it.

 

Is there a way to configure Magento to send order confirmation email only to the store owner and not the customer?

 

I appreciate any help you can give me. 

 

7 REPLIES 7

Re: Stop order email confirmation to customer only Magento 2.3.4

@abbasnails 

 

Yes you can find this configuration in Magento admin panel. 

 

Sharing official document to check:

https://docs.magento.com/user-guide/configuration/sales/sales-emails.html

 

Manish Mittal
https://www.manishmittal.com/

Re: Stop order email confirmation to customer only Magento 2.3.4

rh31U.png

Manish Mittal
https://www.manishmittal.com/

Re: Stop order email confirmation to customer only Magento 2.3.4

Hi @abbasnails 

 

As you have disabled sending emails to customer it will disable rest feature to of sending emails to Site owner as well.

 

You can send email email to site owner by creating a event observer.

 

Please follow these steps to send email programatically :

  1. Create events.xml at app\code\Vendor\Extension\etc\events.xml
    <?xml version="1.0"?>
    <!--
    /**
     * Copyright © 2016 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
       <event name="sales_order_place_after">
            <observer name="send_order_email_copy_to" instance="Vendor\Module\Observer\OrderObserver" />
       </event>
    </config>
  2. Create observer for sales_order_place_after event in Vendor/Module/Observer/OrderObserver.php
    <?php

    use Magento\Framework\Event\ObserverInterface; use Magento\Store\Model\StoreManagerInterface; use Magento\Framework\Mail\Template\TransportBuilder; use Magento\Framework\Translate\Inline\StateInterface; class OrderObserver implements ObserverInterface { protected $storeManager; protected $_transportBuilder; protected $inlineTranslation; public function __construct(StoreManagerInterface $smi,TransportBuilder $tb,StateInterface $si) { $this->storeManager=$smi; $this->_transportBuilder=$tb; $this->inlineTranslation=$si; } public function execute(\Magento\Framework\Event\Observer $observer) { $templateOptions = array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $this->storeManager->getStore()->getId()); $templateVars = array( 'store' => $this->storeManager->getStore(), 'customer_name' => $cname, 'message' => 'We processed your order ID '.$orederid.'. We will contact you soon in mail for the acknowledgement if you not receive mail within 4 hours please get help from support@xxx.com' ); $from = array('email' => "xxxxx@xxx.xxx", 'name' => 'AnyName'); $this->inlineTranslation->suspend(); $to = array('xxxxx@xxx.xxx'); $transport = $this->_transportBuilder->setTemplateIdentifier('order_template') ->setTemplateOptions($templateOptions) ->setTemplateVars($templateVars) ->setFrom($from) ->addTo($to) ->getTransport(); $transport->sendMessage(); $this->inlineTranslation->resume(); } }

NOTE : Change the variables and values accordingly in observer.

 

If issue resolve, please click on 'Kudos' & Accept as Solution!

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Stop order email confirmation to customer only Magento 2.3.4

Hi Manish, thanks for your reply.

 

I have used this configuration in the past. The issue with this approach is that, once you setup  this way, BOTH Customers and Store Owner will get the order confirmation emails.

 

I like to order confirmation for Customers comes from the Mailchimp and only Magento Store Owner be notified by Magento.

Re: Stop order email confirmation to customer only Magento 2.3.4

Thanks for your reply gaurav_harsh1.

 

I was hoping for a simpler configuration solutions, if available.

 

With that said, I'll start creating an event observer, per your direction and let you know if I was able to get it to work.

Re: Stop order email confirmation to customer only Magento 2.3.4

As you have to disable the email sending feature to stop sending emails to customers, then rest features would be deactivated.

 

Well ! Give it a try and let me know if you face any challenges but this is the easiest way to add any functionality after placing any order as per my view, will check if I find any other easy way  Smiley Happy

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Stop order email confirmation to customer only Magento 2.3.4

Will do, and thanks so much for your help!