How to use new appointment hook

SupportHow to use new appointment hook
geraldo Staff asked 6 years ago

I try to use the ea_new_app_from_customer hook which is triggered when a new appointment is booked, but get the following error message from bootstrap.js:848:17 in the browser:

TypeError: response.responseJSON is undefined

So it seems that the hook needs to return a JSON. I tried to do the following but without success:

add_action( 'ea_new_app_from_customer', 'custom_callback_function', 10, 2 ); 

function custom_callback_function( $appointment_id, $appointment_data ) {
// do stuff here
//return $appointment_data;
return json_encode($appointment_data);
}

How should the return statement look like?

1 Answers
Nikola Loncar Staff answered 6 years ago
Hi, that is callback for you to be able to do something with appointments data for example to store it in file etc. You don't need to return value there. Best regards, Nikola
geraldo Staff replied 6 years ago

Thanks Nikola,

I tried to print the $appointment_data and the above error message comes from print_r($appointment_data); which seems to destroy the json returned to calendar.

So finally I print the data using error_log(urldecode(http_build_query($appointment_data)));