Booking Slot Duraton

I do not want users to have the option of changing the booking slot duration, I would like it to be default 60 min. I have tried the snippet Set the default time slot duration #hivepress #bookings · GitHub but it returns that the field is required, I have tried to make it not required but am not having much luck. I also have removed the field from the add listings page.

Please help

Hi,

Please try these PHP snippets:

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

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

		return $attributes;
	},
	1000
);
1 Like

It’s great andrii.

I guess you can’t put that option for a specific category.

For example, what slot duration = 60 minutes only for category x

Hi,

Yes, unfortunately, there is no simple snippet code for this, it would require a custom implementation.

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