How to use new appointment hook
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
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
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)));
Please login or Register to submit your answer