I would like to extend the OrderSender class, located at Magento\Sales\Model\Order\Email\Sender\ and then override the method prepareTemplate($order), this method is actually defined in the Sender class which is located at Magento\Sales\Model\Order\Email\ and only called at OrderSender class as parent::prepareTemplate($order); because the OrderSender class extends Sender, class.

Now how can I override the prepareTemplate($order) method in the OrderSender class which is not defined here but just called?

Note: I don't want to extend its parent class (Sender ) and override the method.

1 Answer 1


You only have two choices

  • 1 : You extend the parent class Sender and override there, but it doesn't seem to suits you

  • 2 : You override the method where the prepareTemplate is called and instead of calling prepareTemplate, you call a custom method that you writte in your extend class. So technically speaking, it won't be an extend of prepareTemplate, just a new method that will do mostly the same thing but with your custom code

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.