Booking form fields - unset

Hi there HivePress Team

We’ve enabled time based booking as we require the booking days and unset some of the not required fields with a code snippet

*add_filter(*
*	'hivepress/v1/forms/listing_update',*
*	function( $form ) {*
*		unset( $form['fields']['booking_window'] );*
*		unset( $form['fields']['booking_min_time'] );*
*		unset( $form['fields']['booking_max_time'] );*
*		unset( $form['fields']['booking_min_quantity'] );*
*		unset( $form['fields']['booking_max_quantity'] );*
*		unset( $form['fields']['booking_slot_duration'] );*
*		unset( $form['fields']['booking_slot_interval'] );*
*		unset( $form['fields']['booking_moderated']);*
*		//unset( $form['fields']['booking_min_length'] );*
*		//unset( $form['fields']['booking_max_length'] );*
*		return $form;*
*	},*
*	1000*
*);*

That’s all working on the Add Listing page, however when making a booking with the hp-form–booking-make form, the user still need to set a time as the _time[] filed is shown on the form.

We’ve tried unsetting the field by modifying the snippet used above on the listing_update form but its not unsetting the filed.

This is the snippet we modified:

*add_filter(*
*	'hivepress/v1/forms/booking-make',*
*	function( $form ) {*
*		unset( $form['fields']['_time'] );*
*		return $form;*
*	},*
*	1000*
*);*

Please assist.

Please try using this hook for the second snippet:

hivepress/v1/forms/booking_update

Note that this may require further customizations, the snippet may not work in this case because bookings require start/end time in any case.

Thanks for the reply Hp Team (Ihor)

The form name we were using turns out to have been the correct one, just without the typo in the form name.
We should have been using underscore (booking_make) instead of the dash (booking-make).

A late night it must have been. :wink:

1 Like

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