Add custom variables in Order Summary Customer Notifications

Hello everyone,

I am trying to add custom variables in Customer Notifications → Order Summary. So, I did this for now:

  1. inside my_changes addon I have register a hook named notification_event_send_before in init.php file.
  2. Inside my func.php file I have my code, doing queries and everything… and return it to the $data array.
function fn_my_changes_notification_event_send_before(
    $event_id,
    $transport,
    &$data,
    &$notification,
    &$template_code
) {
...
$data['order']['carrier_name'] = 'Carrier Name';
...
}

After all these, I have added to my Order Summary Notification, the field:
{o.carrier_name}
but does not display anything… I tried to display an:
error_log("------------- data ---------------");
in order to be sure that the PHP Hook is fired… but I could not find this log anywhere…

Could anyone give me a hint or tip, in order to add custom order variables in notifications ? I have attached a screenshot to understand better

Thank you for your time!

It is easier to create separate variable. Use Barcode, Gift Certificates or Reward Points addon as example

1 Like

Separate variable works from me, don’t have a problem on that. I will give it a try and let yoy know about results. Thank you for your time

1 Like