0.00  View cart

Support WooCommerce Easy Booking Customize Total Booking Duration text

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #7848

    Hi there,

    I’m trying to customize the Total Booking Duration text with the easy_booking_booking_price_details filter, but I’m stuck.

    This is my code so far:

    add_filter( ‘easy_booking_booking_price_details’, ‘easy_bookings_price_details_custom_text’ );

    function easy_bookings_price_details_custom_text( $details, $product, $booking_data ) {
    // this is where I should be able to insert amazing code
    return $details;

    If I add $details = ‘My custom text’; it replaces the text, but the duration and unit will disappear.
    I think I’m missing some parameters from the filter, but I don’t know where to get them.

    Can you help me?


    Plugin's author


    To add text after the existing details, you need to do this:

    add_filter( 'easy_booking_booking_price_details', 'easy_bookings_price_details_custom_text', 10, 3 );
    function easy_bookings_price_details_custom_text( $details, $product, $booking_data ) {
        $details .= '<br />'; // Add a line break
        $details .= 'My custom text';
        return $details;

    Don’t forget the . before =, so it adds text and not replaces it.

    Concerning parameters, $details is the existing details, $product is the product object and $booking_data is an array of information about the selection (dates, duration, price, etc.).

    I can help more if you tell me exactly what you need 🙂



    Hi there!

    Thanks for the quick reply.

    What that code does is to add more text to the details. What I need to do is to replace the text.

    Right now it reads:

    Total booking duration: 2 days

    I need to change it to something like this:

    My custom text: 2 days




    I managed to change the text this way:

    add_filter( 'easy_booking_booking_price_details', 'easy_bookings_price_details_custom_text' );
    function easy_bookings_price_details_custom_text( $details ) {
    	$details=str_replace('Total booking duration', 'My custom text', $details);


    Is it ok, or is there an easier way to do it?


    • This reply was modified 7 months, 1 week ago by Antonio.
    • This reply was modified 7 months, 1 week ago by Antonio.
    Plugin's author

    Ah allright sorry, I misunderstood.

    This filter is not practical to use, I need to improve it.

    In your case, I guess the easiest way would be to use translation files but your solution is ok too.


    Ok, thanks!

    Just out of curiosity, and probably not directly related to your plugin, how would you extract the variables inside a parameter in this function?

    Say I want to find out which variables are inside $booking_data. If I use var_dump($booking_data) or print_r($booking_data) inside the function I get no return.

    This is probably more related to my lack of knowledge than with the function itself. :/

    Plugin's author

    The result is sent to a javascript file and not displayed directly in PHP, this is why you don’t see it. To see the result you need to do the following:

    • Open your browser’s developer tools (F12 on Windows)
    • Go to the “Network” tab
    • Select dates, you should see a “add_new_price” request, click on it
    • Go to the “Response” tab

    Here’s what’s inside $booking_data:

    $start = $booking_data['start'];
    $end = $booking_data['end']; // Optional (two dates only)
    $duration = $booking_data['duration'];
    $new_price = $booking_data['new_price'];
    $new_regular_price = $booking_data['new_regular_price']; // Optional (if product is on sale)

    And I’m currently adding quantity aswell for a future update.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Want to know what's next with Easy Booking? Check the roadmap!