Form booking_make timeslot values

Hi there team HP

I refer topic Booking form fields - unset

Is there a way to pass default values to the booking_make form for the start and end times as the code referred to above works but on the booking_confirm form when clicking to proceed to payment the form presents an error of The start date can’t be later than the end date.?

So you want to set default values for the start and end dates in the booking_make form on the single listing page. Am I correctly understanding you?

Hi there Yevhen
I’d like to pass a default value of 00:00 to the booking_min_time attribute (and hide it with CSS that I can do myself) and let the vendor set the booking_max_time on the listing_submit or listing_update forms.

Thank you for waiting. Please try this PHP code snippet

add_action(
	'hivepress/v1/models/listing/create', 
	function($listing_id) {
		if(hivepress()->get_version( 'bookings' )){
			update_post_meta($listing_id, 'hp_booking_min_time', 0);	
		}
	},
	1000
);

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		if ( isset($attributes['booking_min_time']) ) {
			$attributes['booking_min_time']['editable'] = false;
		}

		return $attributes;
	},
	1000
);

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