0

I have installed collect in store module shipping method. When the order is placed a order confirmation is sent to customers which is magento default transnational email.

Can we send separate email when the shipping method selected as collect in store?

  • is that in magento1 or magento2 ? – hweb87 May 29 '18 at 10:35
  • hi, it is in magento2. – jafar pinjar May 29 '18 at 10:37
  • Hi, have you got the solution ? Looking for same – Ajwad Syed Nov 29 '18 at 12:01
  • @AjwadTaqvi, yes i have resolved it myself – jafar pinjar Nov 29 '18 at 12:23
  • Can you please post it in answer so that I can get help. – Ajwad Syed Nov 29 '18 at 12:31
0

I have override Email Order Sender, to do so

add this in your Vendor/Module/etc/di.xml

<preference for="Magento\Sales\Model\Order\Email\Sender\OrderSender" 
     type="Vendor\Module\Model\Email\Sender\OrderSender" />

Then in OrderSender.php

 <?php
 namespace Vendor\Module\Model\Email\Sender;
 use Magento\Sales\Model\Order;

 class OrderSender extends 
 \Magento\Sales\Model\Order\Email\Sender\OrderSender
  {
 protected function prepareTemplate(Order $order)
 {
   parent::prepareTemplate($order);


    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $cart = $objectManager->get('\Magento\Checkout\Model\Cart');
    $quote = $cart->getQuote();         
    $shippingMethod = $order->getShippingMethod();      
    $objectManager->get('Psr\Log\LoggerInterface')->info($shippingMethod);                  

    if($shippingMethod == 'pickupatstore_pickupatstore_1'){  //your shipping method
      $templateId = 12; //your templateId
    }else{
        $templateId = $this->identityContainer->getTemplateId();
    }

    $this->templateContainer->setTemplateId($templateId);
  }

 }

Hope this will help you!!!

  • hi @Ajwad, is it worked for you? – jafar pinjar Nov 30 '18 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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