Documentation

Add these snippets to your child theme’s functions.php file or use a plugin like Code snippets. Don’t add code directly to the parent theme’s functions.php file as it will be overridden by updates. Customize the texts/values in red to whatever you need.

Remove price calculation

add_filter( 'easy_booking_calculate_booking_price', '__return_false' );

Remove price calculation for some products only

add_filter( 'easy_booking_calculate_booking_price', 'wceb_calculate_booking_price', 10, 2 );

function wceb_calculate_booking_price( $calc, $_product ) {

    if ( $_product->get_id() == 'ID' ) {
        $calc = true; // Set true to enable price calculation, or false to disable.
    }

    return $calc;

}

Early bird pricing

Example for a 5% discount if booked at least 10 days before start date.

add_filter( 'easy_booking_one_date_price', 'wceb_early_bird_pricing', 40, 5 );
add_filter( 'easy_booking_two_dates_price', 'wceb_early_bird_pricing', 40, 5 );

function wceb_early_bird_pricing( $new_price, $product, $_product, $booking_data, $price_type ) {

    $current_date = time();
    $start_date = strtotime( $booking_data['start'] );

    // Get interval between current date and start date
    $interval = (int) ( $start_date - $current_date ) / 86400;

    if ( $interval >= 10 ) {
        $new_price *= 0.95;
    }

    return $new_price;

}