Remove second half of booking time listing slots


i need to remove the second half of booking time listing slots in the time dropdown list.
E.g. i want to show only “18:00” instead of “18:00 - 18:30”.

By modifying the Booking code directly i’m able to do that by modifying the line 670 of the class-booking.php file from

‘text’ => date_i18n( $time_format, $slot_time ) . ’ - ’ . date_i18n( $time_format, $slot_time + $listing->get_booking_slot_duration() * 60 ),


‘text’ => date_i18n( $time_format, $slot_time ),

But i know that i should not modify the code of the plugin directly otherwise my modifications will be overwritten on a update of the plugin.

So my questions are:

  1. is there a way to modify this in the child theme functions.php file?
  2. If not, because i only have to edit one line, can i edit the plugin code directly and where there will be a plugin update i will edit the new version code by editing the line i need?

Thank you in advance!

Thank you for waiting.

Unfortunately, there’s no simple code snippet to change it, but if you’re familiar with customizations or have a developer for custom work, we can provide some guidance if it helps. A possible solution is to create a custom extension where it will be possible to override the time slot value. Here is a tutorial: Create a custom HivePress extension - Developer Docs. In your case, using only these topics from the tutorial is necessary.

In general, there are these steps:

  • create a custom extension with component and controller
  • create a new route in the controller file like the one you found earlier. In this new custom route, you can make changes which you have written before
  • override the source parameter for the time field in the booking make form with hook hivepress/v1/forms/booking_make in the component file and change the value of this parameter on the route name which you have created in step two

I found a easier way to solve MY problem (for others the process described above by yevhen is the best way).
I set the select from element with ‘options’ => [‘07:00’,‘08:00’,‘08:30’,‘09:00’…], then I will handle the options via script by getting the listing minimum and maximum time.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.