Snippet to allow categories with individual time slots and also categories with multiple user per slot

Hi @ihor and @yevhen Hope you both are doing great. I wonder if exists an option to be able to establish categories where hosts can allow multiple users to book a single timeslot and categories where only one user is allowed to book one single slot. This would be extremely helpful for making differentiation between individual vs group services :slight_smile:

Thank you so much!

Let me know!

Unfortunately, there is no possibility to add restrictions by category with time slots. But as another solution, there is the possibility to set Maximum Places per Booking per listing. Also, we can provide a code snippet which will restrict the Maximum Places per Booking option to 1 for new listings from specific categories automatically so these listings will have maximum one person per booking

Hello @yevhen thank you so much for your reply!
I like you solution, how can I set it up? It is in HivePress / bookings/ allow multiple places per booking? How do I set up the maximum places per booking?

Where can I get that code snippet? I think it will be a perfect solution!

Thank you so so much! you guys are the best!

  1. If the Manage availability per vendor setting in HivePress/Settings/Bookings is disabled then you can set the Maximum Places per Booking when you edit/add a listing.
    If the Manage availability per vendor setting in HivePress/Settings/Bookings is active then you can set the Maximum Places per Booking in vendor account settings on the front-end.

  2. Please try this PHP snippet. It will restrict the Maximum Places per Booking option to 1. But please note that it works only for new listings

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

Hi @yevhen Thank you so much. I just want to clarify something. I activated the option to allow multiple places per booking and in the listing vendors have to option to add minimum and maximum amount of places, everything fine there. When you go to the front end in the listing there is an option to add multiple users. I am not quite sure if I understand the logic behind.

In specific, I have the category workshops. I want that multiple individual users can book a specific timeslot, so 10 different users can be able to book individually their place in the workshop if there is still space according to the limit established by the vendor NOT that an individual user can be able to book on behalf of other individual users.

I am not sure if as is set now, if an individual user add three users to the order, then other individual user can still book that specific times slot if there is availability . Can you clarify that for me?

Regarding the snippet, the idea of that snippet is that I can use it in specific categories. So if I use the option of multiple places in the workshops category, I can restrict that option and not allow it in categories designed for individual services. In the snippet I do not see the option to restrict it to an specific category or sub-category. So I am not sure if as it is now it would actually work.

Thanks!

Yes, if you enabled multiple bookings per time period, then if the max number of places is set to 10 and someone books 3 places via a single booking, then 7 places are left (e.g. for 7 different bookings, or for 2 bookings for 3 and 4 places, and so on). Unfortunately, there’s no option to apply this logic to specific listing categories, if multiple bookings per time period are allowed then in the current version these are allowed for any booking. We’ll try to add more options to make all the options available per category and per listing.

Amazing yehen! Thank you for the clarification :slight_smile:

It is right what I needed to know :slight_smile:

1 Like

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