I'm trying to find a way to (optionally) send a message to a customer when an order is cancelled, is there a good way of accomplishing that?
You need to override Controller Cancel.php from below location
path /vendor/magento/module-sales/Controller/Adminhtml/Order/Cancel.php
you can change your message from above file.
Hello joseph_digiovanna
You can use order_cancel_after obsever event and send email to customer for order. 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; }
Hope it will help to solve problem then Accept as Solution or Find helpful then Consider Giving Kudos to this post.