I want to know how can I add some custom code after each booking. I´m using a personal database to store more information for the appointments pointing to the Amelia databases and just need to add a new row on my table once the booking was done, how can I do it? Any hook I can add'
We don't provide WP hooks in our plugin, only JS callback method (with appointment data as parameter), that will be executed (if method is defined) after successful booking.
This method can be added over page editor, e.g.:
<script> window.beforeAddToCalendarLoaded = function (data) { // your code goes here } </script>
Hello,
I want to know how can I add some custom code after each booking. I´m using a personal database to store more information for the appointments pointing to the Amelia databases and just need to add a new row on my table once the booking was done, how can I do it? Any hook I can add'
Thank you.
Angel.
Hi Angel,
Thank you for your inquiry.
We don't provide WP hooks in our plugin, only JS callback method (with appointment data as parameter), that will be executed (if method is defined) after successful booking.
This method can be added over page editor, e.g.:
<script>
window.beforeAddToCalendarLoaded = function (data) {
// your code goes here
}
</script>
Best regards.
Hi Isidora,
So in the page I have the shortcode [ameliabooking] I can add the code you just sent me?
All that I need from the amelia database "wp_amelia_appointments" is the id field of the appointment.
Regards.
Hi Angel,
You will place the code on that page, just in the text area. Please see the picture below for this:
Callback method will return parameter data with fields: data.responseData.booking.appointmentId AND, data.responseData.booking.id that you could use.
Method will be executed after booking so you can get appointment ID from parameter data.
Best regards.
Hi Isidora,
So I guess is not possible to run a SQL query on that function to populate my table with some of that amelia table info, right?
Thanks.
Angel.
Hi Andel,
No, unfortunately you can't. The only way would be to use some existing, or write new endpoint, and to send the data with ajax call.
Best regards.
Hi Isidora,
Ok, thank you for your response.
Regards.
Angel.
Hi Angel,
You are welcome.
Best regards.