/** * Save appointment (final action). */ public function executeSaveAppointment() { $form_id = $this->getParameter('form_id'); $time_is_available = false; if ($form_id) { $userData = new AB_UserBookingData($form_id); $userData->load(); if (AB_BookingConfiguration::isPaymentDisabled() || get_option('ab_settings_pay_locally') || $userData->getFinalServicePrice() == 0) { $availableTime = new AB_AvailableTime($userData); // check if appointment's time is still available if ($availableTime->checkBookingTime()) { $userData->save(); $time_is_available = true; } } } $time_is_available ? wp_send_json_success() : wp_send_json_error(); }