1

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?

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

1 Answer 1

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!!!

1
  • hi @Ajwad, is it worked for you? Nov 30, 2018 at 6:25

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.