I often recommend the WooCommerce Bookings Extension, to clients who want to sell bookable products, on their site. So, what is a bookable product? An event, or say a rental, or an appointment, is an example of a product which can be booked. If you were using this plugin, or were considering using it, I’d like to make you aware of one major limitation:
The possibility to “Search Available Products”, before booking one.
Let me explain. When setting up a hotel website for a client, he put forth this requirement. He needed a search option, which allowed users, to check available rooms, before booking one. The search option wouldn’t be part of a particular product (room), but would rather have to be present on every page of the site. The most reasonable solution was to create a search widget, to check availability of bookable products.
Creating a Availability Search Widget
The widget was simple to create. I had to create the usual widget in WordPress. Do note, since the requirement was to create the widget as part of the theme, I had to add the widget registration code, in functions.php of my theme file. If you wanted to make an extension plugin, you will have to add in your plugin file.
- The widget would add two input fields, for ‘Check-in’ and Check-Out’ dates. Each field could be filled using a datepicker. The datepicker provided was a normal datepicker, and not the one provided by the WooCommerce Bookings extension.
- There was a search button, ‘Check Availability’ provided, which a visitor could use to perform the search results.
- The admin settings for the plugin, allowed the client, to change the labels for the input fields and the search button.
- When a visitor performed an availability search on the site, the results were displayed on a separate page.
Simple, Right?! But how is the search actually performed?
Bookable Product: Using Max Bookings Per Block
The WooCommerce Bookings extension provides a field for every Bookable product, “Max Bookings Per Block”. This field gives an indication of the number of bookable products available. As an example, let’s take the same scenario forward. The client, had several room types, e.g. Royal Suites, Suites, King, Queen and Double, and several rooms for each room type.
He had a total of 5 Royal Suites. Instead of creating 5 different bookable products, he only had to create a single Bookable Product – ‘Royal Suite’, and set ‘Max Bookings Per Block’ as 5.
Checking Availability of WooCommerce Booking
The WooCommerce Bookings extension, then maintains the availability based on the number of products booked.
- The Bookings extension uses the ‘Max Bookings Per Block’ value, to indicate the availability of the room.
- After clicking on the check availability button in the search widget, a database query will be made to check bookable products.
- The availability of the product is checked, for every date between the Check-in and Check-Out dates.
- If a product (room), is available on all days, then it will be selected, and displayed on the search results page.
- A product which has not been booked at all, will also be shown in the search results.
For the client’s project, this criteria was sufficient. But you could consider adding more features.
Adding Filter and Sorting Options
To improve user experience on your site, you can surely add sorting and filtering options. Most websites have these options to make it simpler for visitors to find a product, they are more likely to book.
- The ‘Availability Search’ widget can be extended, to include a filter for room types, or the number of rooms to be booked.
- Options can also be added on the search results page to sort results based on the price of the rooms.
This custom ‘Availability Search’ extension, can be a great addition to any site, which uses WooCommerce Bookings. It adds to better user experience and improved likelihood of customer conversion. Are you thinking of providing this feature on your site, but have trouble implementing it? You can leave your queries in the comment section below, and we can try helping you out.