I want to show the discounted price(price after adding the range) along with the base price of a bookable product what i am doing is changing the code below in the \woocommerce-bookings\includes\adminclass-wc-bookings-ajax.php file
// Build the output
$before = $product->get_price();
$after = wc_price( $display_price ) ;
$discount = $product->get_price() - wc_price( $display_price );
$output = apply_filters( 'woocommerce_bookings_booking_cost_string', __( 'Booking cost', 'woocommerce-bookings' ), $product ) .$discount ': <strong>' .$discount . $price_suffix . '</strong>';
Is this the right way or can you suggest anything?
Overwriting Woocommerce Bookings core code is something that you should absolutely not do for many different reasons that I am not going to explain.
Now as you can see in that source code, developers have added a filter hook to allow you to make changes to the
$output
variable.Now there is not any discounted price in WooCommerce bookable products as there is on WooCommerce other products.
So first place back the original plugin file.
Then you can use the filter as follow (where you will add your own code):
Code goes in functions.php file of your active child theme (or active theme).