I'm observing email_invoice_set_template_vars_before event.

And i want to alter event data. I'm doing it like this:

$transport = $observer->getData('transport');


$observer->setData('transport', $transport);

But, it won't alter the data. Outside of my observer.

I'm using very similar approach with email_order_set_template_vars_before event. Just with difference, that transport is object with setter and getters.

1 Answer 1


Not exact answer, but i solved it by creating plugin for


and creating

public function aroundSetTemplateVars(
    \Magento\Sales\Model\Order\Email\Container\Template\Interceptor $subject,
    callable $proceed,
    array $vars

That way i can alter e-mail variables.

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.