Mark Duration the predefined "Duration" field non mandatory

Hi.
We have hidden the field “Duration” by a Snippet. This fields is predefined: Listings, Attributes. See attachment. We somehow marked this field as mandatory and then it was hidden.
Question now: how can I make it non mandatory as the User still is asked to fill it although its not visible anymore.

It seems like the Booking Slot Interval field which is required for generating time slots for listings

As a possible solution, please try this PHP snippet which sets 10 minutes by default as the booking slot duration when a new listing adding

add_action(
	'hivepress/v1/models/listing/create', 
	function($listing_id, $listing) {
		error_log('t');
		if(hivepress()->get_version( 'bookings' ) && hivepress()->booking->is_time_enabled($listing)){
			update_post_meta($listing_id, 'hp_booking_slot_duration', 10);
			error_log('te');
		}
	},
	1000,
	2
);

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

		return $attributes;
	},
	1000
);

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