Hi,
You don't need the $smarty variable. Simply return an array of key/value pairs that you want to replace/add.
return [
'companyname' => 'The replaced company name',
'some_new_var' => 'new val',
];
I know this topic is old but this is what I found through searching. Anyway, the hook that I found was useful for me is "AfterShoppingCartCheckout". According to docs: `Upon completion of checkout once the order has been created, invoice generated and all email notifications sent`.
Meaning that it's run before the order is paid but when it's created. Hope this is useful to someone.