We're Moving to a New Support Platform – Starting June 1st!

We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.

You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.

While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.

We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.

Thanks for your continued support and trust – we’re excited to bring you an even better support experience!

Okay
  Public Ticket #1882789
Add custom code after booking
Closed

Comments

  •  2
    olderdais started the conversation

    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.

  • [deleted] replied

    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.

  •  2
    olderdais replied

    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.


  • [deleted] replied

    Hi Angel,

    You will place the code on that page, just in the text area. Please see the picture below for this:4033061835.png


    Callback method will return parameter data with fields: data.responseData.booking.appointmentId AND, data.responseData.booking.id that you could use.

    9258631732.png


    Method will be executed after booking so you can get appointment ID from parameter data.

    Best regards.

  •  2
    olderdais replied

    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.

  • [deleted] replied

    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.

  •  2
    olderdais replied

    Hi Isidora, 

    Ok, thank you for your response.

    Regards.

    Angel.

  • [deleted] replied

    Hi Angel,

    You are welcome. 

    Best regards.