2

I searched the internet and founded nothing.

I need to send an email to customer when the order is canceled. I've founded the trigger order_cancel_after when the order is canceled, but that' all i founded.

4

1 Answer 1

3

order_cancel_after -> it's dispatched in the cancel method of \Magento\Sales\Model\Order :

public function cancel()
{
    if ($this->canCancel()) {
        $this->getPayment()->cancel();
        $this->registerCancellation();

        $this->_eventManager->dispatch('order_cancel_after', ['order' => $this]);
    }

    return $this;
}

Source : What is the event will fire after cancelled the order in Magento 2


Magento does send a number of transnational emails, including cancellation. (e.g. order status change); the only issue with a cancellation email, requires the customer service agent cancelling to click Notify Customer. You can edit this to be the default.

To enable emails on order comments, go to Store > Configuration > Sales > Sales Emails and make sure order comment is enable. It take from your E-mail template


FYI : This class Magento\Sales\Helper\Data send all email for order transaction.

7
  • yeah, i said i know the method to cancel order. But how to send email when this method is called?
    – Deniss
    Jul 6, 2017 at 10:42
  • okey i will provide Jul 6, 2017 at 10:44
  • I provide the comments :) Jul 6, 2017 at 11:04
  • hmm, but methods in Magento\Sales\Helper\Data should be called somewhere.
    – Deniss
    Jul 6, 2017 at 11:07
  • check Magento\Sales\Block\Adminhtml\Order\View\History Jul 6, 2017 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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