Hello there,
I want to programatically set daily prices on the calendar. The effect should be same as if user updated prices using front end calendar.
Where are the daily prices stored?
Kind regards,
Jovica
Hello there,
I want to programatically set daily prices on the calendar. The effect should be same as if user updated prices using front end calendar.
Where are the daily prices stored?
Kind regards,
Jovica
Hi,
Please try this sample code snippet:
$range = ( new \HivePress\Models\Booking_Range() )->fill(
[
'start_time' => $start_time,
'end_time' => $end_time,
'price' => 123,
'user' => $user_id,
'listing' => $listing_id,
]
);
$range->save();
It requires start and end time (timestamps), listing ID along with the listing author (user) ID, and a custom price. This code adds a custom price range applied when the booking overlaps it, you can also check range_dates function in hivepress-bookings/includes/controllers/class-booking.php file for more details, this function is called when a custom price is set for selected dates in the calendar.
Hope this helps
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.