문제

Hi is it also possible to get email notification for cancelled orders?

Thanks

도움이 되었습니까?

해결책

You can always write your own module that will do that.

You will need few ingredients for that:

  1. Have an observer that listens on the sales_order_save_after event.

    This link explains it well

    catch order place after event magento2

    In this observer you will get the order object by $order= $observer->getData('order'); and you could check if the new status is canceled

  2. If condition from point 1 above is true you can proceed to send an email programatically. This link offers good idea of how to do that

    How to send mail programmaticlly in magento2?

다른 팁

You will need to create a separate functionality for sending the email on order cancellation.

You can use the order_cancel_after event for writing your email function.

You can get the order details using the order object as given below

<?php

namespace Vendor\Module\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class OrderCancellationEmail implements \Magento\Framework\Event\ObserverInterface
{
    /**
     *
     * @param \Magento\Framework\Event\Observer $observer
     * @return $this
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $order = $observer->getData('order');
        // Write your email function here
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top