Created
November 4, 2024 09:48
-
-
Save kartikparmar/22f60810dc012376f1969696ce19afbd to your computer and use it in GitHub Desktop.
customize the booking price based on the custom fields
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 | |
*/ | |
echo '<pre>'; | |
print_r( $price_data ); // this variable contains the above shared details. | |
print_r( $product_id ); // this variable contains the product id. | |
print_r( $_POST ); // this variable contains all the selection made by the customer. | |
echo '</pre>'; | |
/* Here you can fetch the price based on the selecte number of days from your custom field | |
and set to $price_data array | |
*/ | |
return $price_data; | |
} | |
add_action( 'bkap_final_price_json_data', 'custom_price_calc', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment