View Categories

Filters Associated With Checkout Page

Filter : wp_travel_checkout_fields #

This filter helps to remove the Country field on the checkout page.

function wp_travel_billing_form_edit_fields( $checkout_fields ) {
  unset( $checkout_fields['traveller_fields']['country']);
   return $checkout_fields;
}
add_filter( 'wp_travel_checkout_fields', 'wp_travel_billing_form_edit_fields' );

This filter helps toย remove notes from billing details.

add_filter( 'wp_travel_checkout_fields', 'remove_wp_travel_billing_note_field' );
function remove_wp_travel_billing_note_field( $checkout_fields ) {
        unset( $checkout_fields['billing_fields']['note'] );
    return $checkout_fields;
}

Filter: wp_travel_show_pricing_label_on_name #

This filter helps to remove the price name from the checkout page and cart page.

function wp_travel_remove_price_cartpage() {
    return false;
}
add_filter( 'wp_travel_show_pricing_label_on_name', 'wp_travel_remove_price_cartpage' );

Filter: wp_travel_apply_coupon_errors #

function prefix_wp_travel_apply_coupon_errors( $message ) {
    $message = โ€˜<p> This is an error message. </p>โ€™;
    return $massage;
    }
add_filter( 'wp_travel_apply_coupon_errors', 'prefix_wp_travel_apply_coupon_errors' );

Filter: apply_filters( wp_travel_country_list, $countries ) #

function prefix_wp_travel_country_list( $countries ) {
    $countries[โ€˜COUNTRY SHORT FORMโ€™] = โ€˜COUNTRY NAMEโ€™;
    return $countries;
}
add_filter( 'wp_travel_country_list', 'prefix_wp_travel_country_list' );

Filter: wptravel_default_payment #

The wptravel_default_payment hook is used to set the default payment gateway selected on the WP Travel checkout page.

function prefix_wptravel_default_payment( $selected_gateway ) {
    $selected_gateway = 'paypal';
    return $selected_gateway;
}
add_filter( 'wptravel_default_payment', 'prefix_wptravel_default_payment' );

Filter: wp_travel_get_checkout_url #

A Checkout URL filter can be used to modify the URL that WP Travel uses for the checkout page.

function prefix_wp_travel_get_checkout_url( $url ) {
    $url = 'PLACE URL';
    return $url;
}
add_filter( 'wp_travel_get_checkout_url', 'prefix_wp_travel_get_checkout_url' );

Filter: wp_travel_require_all_travelers_fields #

This hook is used to make all traveler information fields mandatory during the WP Travel booking and checkout process.

function prefix_wp_travel_require_all_travelers_fields() {
    return true;
}
add_filter( 'wp_travel_require_all_travelers_fields', 'prefix_wp_travel_require_all_travelers_fields' );

Filter: wp_travel_hide_mini_cart_on_checkout #

This hook is used to hide the mini cart section on the WP Travel checkout page.

function prefix_wp_travel_hide_mini_cart_on_checkout() {
    return true;
}
add_filter( 'wp_travel_hide_mini_cart_on_checkout', 'prefix_wp_travel_hide_mini_cart_on_checkout' );

Filter: wptravel_checkout_enable_media_input #

Add the file upload option on the checkout page

add_filter( 'wptravel_checkout_enable_media_input', function(){ 
  return true; 
} );

Filter: wptravel_checkout_media_input_label #

Change the label

add_filter( 'wptravel_checkout_enable_media_input', function(){ 
  return true; 
} );

Filter: wp_session_expiration #

To learn more about the session, please refer to the link How to Fix the Empty Cart Issue Due to Session Expiry in WP Travel.

add_filter( 'wp_session_expiration', function( $expiration ) {
    return 24 * 60 * 60; // 24 hours in seconds
});

Filter: wp_travel_woo_enable_onapage #

This hook can be used for integrating On-page checkout while enabling WooCommerce payment

add_filter(โ€˜wp_travel_woo_enable_onapageโ€™, function() {
    return true;
});