Filters Associated With Cart Page

Filter: wp_travel_enable_cart_page #

This filter helps to add the cart page which has been removed from the WP Travel version 4.3.2.

Example :

remove_filter( 'wp_travel_filter_is_enabled_cart_page', 'wp_travel_enable_cart_page', 10, 2 );

Filter: wp_travel_allow_multiple_cart_items #

Allow multiple cart items. Default is false.

Source

File: /core/helpers/cart.php
Used by: /core/helpers/cart.php, /core/REST/cart.php, /inc/booking-functions.php. /inc/class-ajax.php, /inc/payments/wp-travel-payments.php

Example:

function prefix_wp_travel_allow_multiple_cart_items() {
    return true;
    }
add_filter( 'wp_travel_allow_multiple_cart_items', 'prefix_wp_travel_allow_multiple_cart_items' );

Filter: wp_travel_cart_attributes #

Trip cart details.

Source

File: /core/helpers/cart.php
Used by: /core/helpers/cart.php, /inc/class-ajax.php

Parameters
$data

Example:

function prefix_wp_travel_cart_attributes( $data ) {
    $data[‘enable_partial’] = true;
    return $data;
}
add_filter( 'wp_travel_cart_attributes', 'prefix_wp_travel_cart_attributes' );

Filter: wp_travel_filter_update_cart_on_add #

Update cart on add. Default is true.

Source

File: /core/helpers/cart.php
Used by: /core/helpers/cart.php, /inc/class-ajax.php

Example:

function prefix_wp_travel_filter_update_cart_on_add() {
    return false;
    }
add_filter( 'wp_travel_filter_update_cart_on_add', 'prefix_wp_travel_filter_update_cart_on_add' );

Filter: wp_travel_filter_is_enabled_cart_page #

Cart page enable/disable.

Active Since v4.3.2

Source

File: /core/helpers/cart.php
Used by: /core/helpers/cart.php

Parameters
$enabled, $settings

Example:

function prefix_wp_travel_filter_is_enabled_cart_page() {
  return false;
}
add_filter( 'wp_travel_filter_is_enabled_cart_page', 'prefix_wp_travel_filter_is_enabled_cart_page' );

Filter: wp_travel_cart_sub_total #

Cart total price.

Source

File: /core/lib/cart.php
Used by: /core/lib/cart.php, /inc/cart/class-cart.php

Parameters
$cart_total

Example:

function prefix_wp_travel_trip_extras_custom_sale_prices( $cart_total ) {
    return ( $cart_total + 100 );
}
add_filter( 'wp_travel_cart_sub_total', 'prefix_wp_travel_cart_sub_total' );

Filter: wp_travel_cart_get_total_fields #

Total cart prices ( cart_total, discount, tax etc ) in array.

Source

File: /core/lib/cart.php
Used by: /core/lib/cart.php, /inc/cart/class-cart.php

Parameters
$get_total

Example:

function prefix_wp_travel_cart_get_total_fields( $get_total ) {
    $get_total[‘discount’] = 20;
    return $get_total;
}
add_filter( 'wp_travel_cart_get_total_fields', 'prefix_wp_travel_cart_get_total_fields' );

Filter: wp_travel_filter_cart_item_id #

Filter for cart item ID.

Active Since v1.5.8

Source

File: /core/lib/cart.php
Used by: /core/lib/cart.php, /inc/cart/class-cart.php

Parameters
md5( $cart_item_id ), $trip_id, $price_key, $start_date

Example:

function prefix_wp_travel_filter_cart_item_id( $cart_item_id ) {
    $cart_item_id = 123;
    return $cart_item_id;
}
add_filter( 'wp_travel_filter_cart_item_id', 'prefix_wp_travel_filter_cart_item_id' );

Filter: wp_travel_cart_success #

WP Travel notice for cart update success.

Source

File: /inc/class-ajax.php
Used by: /inc/class-ajax.php

Example:

function prefix_wp_travel_cart_success() {
    return ‘<p> Message here. </p>’;
}
add_filter( 'wp_travel_cart_success', 'prefix_wp_travel_cart_success' );

Filter: wp_travel_get_cart_url #

WP Travel cart url filter.

Active Since v1.5.7

Source

File: /inc/helpers.php
Used by: /inc/helpers.php

Parameters
$url

Example:

function prefix_wp_travel_get_cart_url( $url ) {
    $url = “PLACE URL”;
    return $url;
}
add_filter( 'wp_travel_get_cart_url', 'prefix_wp_travel_get_cart_url' );

Filter: wp_travel_use_cart_trip_time #

Cart trip time.

Source

File: /inc/cart/cart-mini.php
Used by: /inc/cart/cart-mini.php

Parameters
Default is ‘ ’, $cart_item

Example:

function prefix_wp_travel_use_cart_trip_time() {
    return ‘TRIP TIME’;
}
add_filter( 'wp_travel_use_cart_trip_time', 'prefix_wp_travel_use_cart_trip_time' );

Filter: wp_travel_cart_mini_custom_partial_value #

Custom partial value on mini cart.

Source

File: /inc/cart/cart-mini.php
Used by: /inc/cart/cart-mini.php

Parameters
$args

Example:

function prefix_wp_travel_cart_mini_custom_partial_value( $args ) {
    $args[‘price_partial’] = 200;
    return $args;
}
add_filter( 'wp_travel_cart_mini_custom_partial_value', 'prefix_wp_travel_cart_mini_custom_partial_value' );

Filter: wptravel_skip_add_to_cart #

Hook to skip add to cart while booking trip.

Active Since v4.6.3

Source

File:  inc/class-ajax.php
Method/Function:  add_to_cart

Parameters
$skip_cart [default parameter with default value false]

Example:

function wptravel_customized_skip_to_cart( $skip_cart ) {
   return true;
}
add_filter( 'wptravel_skip_add_to_cart', 'wptravel_customized_skip_to_cart' );