Search Documentation

WP Travel Developer Documentation

  1. Home
  2. Docs
  3. WP Travel Developer Documentation
  4. Action Hooks
  5. Action : wp_travel_after_frontend_booking_save

Action : wp_travel_after_frontend_booking_save

Hook used to add payment and its info.

Active Since v1.0.5

Source

File: /inc/booking-functions.php
Used by: /inc/booking-functions.php

Parameters
$booking_id, $first_key

Example:

function prefix_wp_travel_after_frontend_booking_save( $booking_id, $first_key ) {
    if ( ! $booking_id ) {
        return;
    }

    $gateway = isset( $_POST['wp_travel_payment_gateway'] ) ? $_POST['wp_travel_payment_gateway'] : '';
    if ( 'bank_deposit' === $gateway ) {

        $payment_id = wp_travel_get_payment_id( $booking_id );

        $payment_mode = get_post_meta( $payment_id, 'wp_travel_payment_mode', true );
        update_post_meta( $booking_id, 'wp_travel_booking_status', 'booked' );
        update_post_meta( $payment_id, 'wp_travel_payment_status', 'waiting_voucher' );
    }

}
add_action( 'wp_travel_after_frontend_booking_save', 'prefix_wp_travel_after_frontend_booking_save'  );
Was this article helpful to you? Yes No

How can we help?