Search

Create an Availability Search for WooCommerce Bookings Extension

    Praveen Chauhan
Listen to this article

Appointments Booking WooCommerceI 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.

[space]

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.

[space]

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.

Room Availability Checking WooCommerce
Room Availability Check Widget Interface
  • 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?

Read on.

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.

WooCommerce Bookings
Max Bookings Per Block – WooCommerce

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.

[space]

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.

[space]

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.

[space]

Conclusion

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.

Praveen Chauhan

Praveen Chauhan

27 Responses

  1. Your widget is exactly what I’m looking for!

    Building a site for a client and nearly finished – using the woocommerce bookings extension. Everything works supremely well with the exception that the widget you wrote about is not provided by Woo and I don’t have the coding experience necessary to to add it.

    The client manages over 90 vacation rental properties and every other filter and search I’ve loaded into the site works beautifully to narrow a search down to the nth degree, but without that availability widget somewhere on the site, the prospective customer has to look at the availability calendar for each property to determine if that is going to fit their vacation plans. Clearly not a good solution as one or more results that don’t meet their vacation plans will result in them going somewhere else (plenty of competition in the area, so we need to keep em when we get em on the site)

    Your assistance would be greatly appreciated.

    Thank you for stepping up to the plate with this solution!

    1. Hi Brian,

      Thank you for your comment. Yes the availability search is a limitation of the WooCommerce Bookings extension. We would be happy to help you. Someone from our team will contact you soon enough.

    1. Hi Heather,
      The WooCommerce Bookings Extension, does not provide enough hooks to provide a reusable solution. So, we provide it as a custom solution.

      1. Please tell me more about that. How much is it, do you have an example, etc… I am looking to get something implemented asap.

  2. Hey, great writeup. I am very much interested in this customization exactly as described. Could you have someone get in touch with pricing information? Thanks!

    1. Hi Jose,
      Thank-you 🙂 I’ve forwarded your contact to the Business Development team, they will contact you soon.

  3. I have upgraded my plugin and see that this widget is in there. I am wondering if it is possible to add a category filter.

    I am renting out rooms in different states, and would like to search by state if possible. Can someone maybe push me in the right direction?

    Thanks!

    Ramses – the Netherlands

    1. Hi Germain,

      The effort to build such an extension is about 20 Hours. If you are interested, you can contact us via the contact form on our site.

  4. Hello Team, Is it possible to combine the search with other filters like attributes or categories?

    1. Hello karthik,
      Fantastic. Do you have an email where I can be in contact with you?

      Thanks
      Santiago Helmann

  5. Hello Karthik,
    Sorry for the late response. Actually, this have sense if after search and select the item to book, this info is pulled to the calendar, so the client dosen’t need to click on dates for a second time.
    Do you think is this possible too?
    Thanks Santiago Helmann

  6. In case anyone comes here and wants a sample code to start, I’ll leave here this.

    Please note this is almost pseudo code, it only serves to explain the “how to do it” and does not attempt to be “The Way” to do it.
    The code NEEDS to be refined in order to work as expected.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads