my website deals with many categories. For most of them the option to Allow multiple places per booking AND Multiply price by the number of places will be used together. But for other categories, like houses and apartments, I obviously do not want to multiply the price per night by the number of guests because people will pay per room (house, apartment) in that case.
I would need a small snippet if possible which could hide the Guests field in the listings page ONLY when the listing is in a specific category, like houses, apartments, rooms, etc.
The other option in case the first one is not possible would be to disable multiplying price by guests for those categories only. That seems more complicated but maybe more elegant.
Thanks for the help!
Also, in the same way, I am trying to add a category (attractions) which you can’t book or pay for. Would it be possible to add snippets to hide the Attributes (primary), the Booking Form, and the Actions (primary) widgets in the listing page when the listing belongs to a specific category (attractions)?
Thanks a lot!
Sorry, there’s no simple code snippets for this, it would require a custom implementation. If customizations beyond the available features are required for your site, please consider hiring someone for custom work https://fvrr.co/32e7LvY
I have seen someone else made a very similar request, but instead of removing the guests for a specific category, it removes the guests for all time enabled categories. This is the link Hide fields to set places per booking in categories - #7 by muslimbnb .
The snippet is already there, made by “yevhen”. I am not sure if what I am asking (in my first question at least) requires a completely different snippet, but I don’t think so. Could you have a look?
I’ll try to give andrii a hand here from what I have been learning implementing my own code.
I checked the link you provided. The difference is that in functions.php you can provide a general instruction to how a block behaves, and that’s theoretically much simpler to do in the sense that you just have to add a snippet and you’re done.
You are asking for behaviors in different conditions, thus, you have to create a child template, then you have to modify the code that builds the booking block (maybe in functions.php I am not sure), but also modify the booking plugin to work like that for selected categories (possibly making your own booking plugin, otherwise you risk changes will be overridden after update).
I believe this is why andrii insists there is no simple code snippets you can create to follow different conditions in the same manner that you provide in the link.
it’s not worth the effort then. I think I can make it work somehow with the link I was referring to and some tweaks. Not perfect, but will do for now
Thanks anyways! (and if you have an idea about my second question, I am all eyes!)
As a matter of fact I just thought of a third solution (consider it, as its much-much easier):
Instead of thinking modifying hivepress, think of changing behavior in specific pages.
For every page you have booking block, add a body function to check category in the listing, or even in the URL, instead of the listing block , if condition is met, then run snippet to restrict guest number.
I am thinking also that the category must be written in the heading or a p block, you could parse the category and that makes it also, and even though its not very elegant code, your customer will never notice and would fit your needs as a temporal solution.
That should make it for every ™page™ that runs under the category for every specific exception.
so far my workaround is working, but I will keep this one as a backup!