Auto Confirming Free Appointments - Help

Hi,

I have a great little bit of code tweak which auto converts my pending treatments to confirmed when clients select the manual payment option. This allows them to pay for my services time at treatment and is working great.

I have the following code installed in my 'manual payments'.php file. Unfortunately I'm currently offering a free treatment day but because the treatment is free the client isn't slecting the manual payments option so this code isn't being implmented. As such all my free taster services I'm currently offering are getting stuck in pending. Can someone help me auto confirm these free treatments asap please!!

function order_confirmation($order) {
      global $appointments ;
      if ( isset( $_COOKIE["wpmudev_appointments"] ) ):
          $apps = unserialize( stripslashes( $_COOKIE["wpmudev_appointments"] ) );
          $apps = array_values(array_filter(array_map('intval', $apps)));
              foreach ($apps as $id) {
                  $a = $appointments->get_app($id);
                  if('pending' === $a->status){
                      $appointments->change_status('confirmed',$id);
                      $appointments->send_confirmation($id);
                  }
              }
      endif;
  }

Thanks in advance