This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function custom_price_calc( $price_data, $product_id ) { | |
| /* | |
| You can change the following data | |
| total_price_calculated - Total Booking Price | |
| bkap_price_charged - Booking price being charged to customer [This could be vary if deposits addon is being used] | |
| bkap_price : Text being displayed in the Price section - https://prnt.sc/ku_AQFhjUY36 | |
| To understand bit more how the data being prepared and passed based on the cutomer selection then you can check for bkap_special_booking_show_multiple_updated_price function | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function bkap_selected_number_of_nights( $number, $checkin_date, $checkout_date, $product_id, $booking_settings ) { | |
| $dates = bkap_common::bkap_get_betweendays( $checkin_date, $checkout_date, 'Y-m-d' ); | |
| foreach ( $dates as $date ) { | |
| $day = date( 'w', strtotime( $date ) ); | |
| $weekday_name = 'booking_weekday_' . $day; | |
| if ( '' === $booking_settings['booking_recurring'][$weekday_name] ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Date Picker Example</title> | |
| <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> | |
| <style> | |
| .date-list { | |
| list-style-type: none; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Function to enqueue the custom script to move WooCommerce Error Notices | |
| function bkap_move_woocommerce_notices_above_booking_form() { | |
| if ( is_product() ) { | |
| ?> | |
| <script> | |
| jQuery(document).ready(function($) { | |
| var wooNotices = $('.woocommerce-error'); | |
| if ( wooNotices.length && $('.bkap-booking-form').length ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * This function will change the calendar icon of the Date selection fields in the front-end booking form. | |
| */ | |
| function bkap_calendar_custom_icon_file() { | |
| return 'https://www.pngfind.com/pngs/m/681-6816950_small-calendar-icon-png-transparent-png.png'; | |
| } | |
| add_filter( 'bkap_calendar_icon_file', 'bkap_calendar_custom_icon_file' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function update_subscription_with_original_price( $subscription_id, $args ) { | |
| global $wpdb; | |
| // Get the download ID from the $args array | |
| $download_id = $args['product_id']; | |
| // Get the price ID if variable pricing is used | |
| $price_id = ! empty( $args['price_id'] ) ? $args['price_id'] : null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * This function will not ignore the Advance Booking Period settings on Backend. | |
| */ | |
| function bkap_advance_booking_period_callback( $abp ) { | |
| return is_admin() ? 0 : $abp; | |
| } | |
| add_filter( 'bkap_advance_booking_period', 'bkap_advance_booking_period_callback', 10, 1 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * This function consider the booking price as 0 for the particular product. | |
| */ | |
| function bkap_modify_booking_price_to_zero( $time_slot_price, $product_id, $variation_id, $product_type ) { | |
| $products_to_consider_price_as_zero = array( '18290', '1234' ); | |
| if ( in_array( $product_id, $products_to_consider_price_as_zero ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $args = array( | |
| 'post_type' => 'bkap_booking', // Replace with your actual custom post type | |
| 'meta_query' => array( | |
| 'relation' => 'AND', | |
| array( | |
| 'key' => '_bkap_product_id', | |
| 'value' => '123', | |
| 'compare' => '=' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Add booking fee to price on product page. | |
| * | |
| * @param string $total_price Booking Price. | |
| */ | |
| function bkap_additional_booking_price( $total_price ) { | |
| // Here you can add additional condition according to business requirements. | |
| // This will add 15 to booking price for all the bookable product on the store. |