=== Hotel Booking for WooCommerce ===

Contributors:      uptonines
Tested up to:      6.9.4
Stable tag:        1.1.18
Requires at least: 6.0
Requires PHP:      8.0
License:           GPLv2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Tags:              hotel booking, booking, accommodation, reservation, woocommerce

Adds a reservation system for a hotel, B&B, villa, apartments, hostel, or any similar accommodation into your WooCommerce website easily!

== Description ==

[Live Demo](https://uptonines.com/plugins/hotel-booking-for-woocommerce/) | [Documentation](https://uptonines.com/documentations/hotel-booking-for-woocommerce/)

Looking to add a professional hotel booking system to your WooCommerce website? The **Hotel Booking for WooCommerce** plugin is the perfect solution for easily managing bookings at your hotel, B&B, villa, apartment, hostel, or any similar accommodation. If you're already comfortable with WooCommerce, this plugin will seamlessly integrate into your site, allowing you to manage your accommodations like a pro.

**Start with the free version** and unlock a range of essential features. You can create custom rate plans for your accommodation, set room allotments to prevent overbooking, and apply minimum stay rules for each room. The plugin also lets you offer a simple yet effective availability check, where customers can search for rooms based on their desired check-in and check-out dates, number of guests, and — optionally — the number of rooms they need. This enables direct bookings based on real-time availability, making the booking process smooth and hassle-free. You can even place the availability search form on any page via shortcode, and customize the room amenities with icons or custom SVGs for a unique touch.

The free version also offers **flexible payment options** by supporting any payment gateway available through WooCommerce. Additionally, you can set custom prices for specific dates within the **default rate plan**, and quickly make bulk edits to rate plans and availability. Also, the **Booking Add-on** feature allows you to include optional extras (such as breakfast, airport pickup, or late checkout) as part of the booking process.

While the free version offers plenty of features to get started, upgrading to the **Pro version** will unlock even more advanced tools. You can set custom prices and open/close rates per date for **any rate plan**, not just the default one. Bulk editing is expanded to include all rate plans, giving you the flexibility to manage your pricing strategy more efficiently.

The **Pro version** also enhances the Booking Add-on feature, allowing pricing per booking, per guest, or per night. On top of that, you can **sync your availability with external OTA calendars** like **Booking.com** or **Airbnb** using iCal — ensuring you never get double-booked.

Get started today with the **free version**, explore its powerful features, and when you're ready to take your hotel booking system to the next level, upgrading to the **Pro version** will give you all the tools you need for a fully optimized booking experience. Download the plugin now and start managing your bookings with ease!

= Features included in free version =
- Create custom rate plans for your accommodation.
- Set room allotments to avoid overbooking.
- **Recommended**: Exclude accommodation from your shop page.
- Availability check: Allow customers to search available rooms based on check-in, check-out, and guest count, and make direct bookings from the results page.
- **Multi-room search** (optional): Enable a "Rooms" field in the search form so customers searching for multiple rooms (e.g. a group needing 3 rooms) get accurate results. Capacity and availability checks automatically account for the total number of rooms requested.
- Display the availability search form on any page using a shortcode.
- **Flexible payment gateway.** Use any payment method supported by WooCommerce.
- Set custom prices per date for the **default rate plan**.
- Open/close rates per date for the **default rate plan**.
- Bulk edit pricing and availability for the default rate plan.
- Add room amenities with icons or custom SVGs.
- Booking Add-on feature.
- Define minimum stay rules for the **default rate plan**.

= Features included in PRO version =
- All features from the free version.
- Set custom prices per date for **any rate plan**.
- Open or close availability **per date for each rate plan**.
- Bulk edit pricing and availability across all rate plans.
- Sync your rooms with external OTA calendars like Booking.com or Airbnb.
- More flexible Booking Add-on (per booking, per guest, per night, apply add-ons only for specific room).
- Define minimum stay rules for **any rate plan**.
- Occupancy Pricing Rules
- Seasonal Pricing
- Booking Window Discount Rules

== Installation ==

= Installation from within WordPress =

1. Make sure you have install and activate WooCommerce plugin.
2. Visit **Plugins > Add New**.
3. Search for **Hotel Booking for WooCommerce**.
4. Install and activate the Hotel Booking for WooCommerce plugin.

= Manual installation =

1. Make sure you have install and activate WooCommerce plugin.
2. Upload the entire `hotel-booking-for-woocommerce` folder to the `/wp-content/plugins/` directory.
3. Visit **Plugins**.
4. Activate the Hotel Booking for WooCommerce plugin.

== Frequently Asked Questions ==
= How to show the availability search form? =
Simply use the shortcode `[hbfwc_search_form page='8']` in any page. Change the "page" attribute value with the page id or page path where the availability results shortcode is placed.

= How to show the availability results on a page? =
Simply use the shortcode `[hbfwc_availability]` in a page that you use as the rooms/accommodation search results page (availability page).

= How to modify the output of the layout? =
We follow the WooCommerce templating system. You can override the plugin's templates by copying our templates into your active theme directory. Please read the comment written on the top of each template file and follow the instruction. Please note that, modifying the container ids and classes is not recommended, since we use some javascript which relies to some container ids and classes to handle the functionality.

= Can we turn off the plugin default styling? =
Yes, we have providing a hook to disabled the plugin css. [documentation](https://uptonines.com/documentations/hotel-booking-for-woocommerce/snippets/)

= How do I let customers search for multiple rooms at once? =
Go to **WooCommerce > Settings > Hotel Booking** and enable the **"Show Rooms field in search"** option. A "Rooms" stepper will appear in both the search form and the availability filter form. When a customer sets Rooms to 2 and Adults to 4, the plugin checks whether at least 2 rooms are available for those dates and whether the combined capacity (max adults per room × 2) covers 4 guests — so groups are handled correctly.

== Screenshots ==
1. Simple plugin settings.
2. Product data - General.
3. Product data - Rates and Prices.
4. Product data - Amenities.
5. Manage amenities.
6. Manage rate plans.
7. Manage availability and prices per date.
8. Bulk updates.
9. Front-end example.
10. Room search block
11. Availability results block

== Changelog ==
= 1.1.18 =
* Fix: Availability notices now use clearer wording when requested rooms are limited or unavailable for the selected dates.
* Fix: Multi-date availability messages in the rate list are now shown as cleaner separate lines for better readability.
* Enhancement: Refined the front-end room information layout for improved spacing and wrapping.

= 1.1.17 =
* Fix: Availability results now keep the correct cart item synced when the page is refreshed or revisited.
* Fix: Related accommodation queries now return product IDs (not product objects), preventing object-to-int/float PHP warnings in WooCommerce block queries.
* Fix: Accommodation quantity displays in the cart and cart block now use a clearer room/rooms label while keeping the fixed-quantity booking flow.
* Enhancement: Added a mini-cart extension hook for booking meta output.
* Enhancement: Refined the admin availability starter layout.

= 1.1.16 =
* Feature: Added optional "Rooms" field to availability search and filter forms, controlled by a single WooCommerce > Hotel Booking setting.
* Fix: Availability search – rooms count was not preserved in the filter form after a search (rooms always reset to 1).
* Fix: Rate card capacity checks now correctly multiply per-room max adults/children limits by the number of requested rooms, so a group of 6 guests finds rooms that sleep 2 when 3 rooms are requested.
* Fix: Admin Availability & Price – corrected date range results.
* Security: Escaped output in booking add-on metabox column values (addon type and addon price).
* Security: Replaced unescaped radio field output with wp_kses_post() in plugin settings.
* Security: Sanitised $_GET date parameters in admin availability screen using absint() before passing to wp_date().
* Security: Sanitised $_POST['product-type'] through sanitize_text_field() in product panel save.
* Enhancement: All AJAX date inputs now cast through absint() to prevent type-juggling issues.
* Enhancement: Added is_array() guard on $_GET['children_age'] before array_map to prevent type errors.
* Enhancement: Add-on price in cart calculation is now re-fetched from post meta instead of trusting the session value, preventing price manipulation.
* Enhancement: Added rel="noopener noreferrer" to external links; fixed target="blank" typo to target="_blank".
* Enhancement: General code quality and hardening improvements.

= 1.1.15 =
* Fix: Minor bug in admin js
* Minor code improvements and optimizations

= 1.1.10 =
* Enhancement: Improved item meta display in the cart and checkout for compatibility with the latest WooCommerce version.
* New: Added an admin hook to allow registering additional submenus under existing HBFWC menu items.

= 1.1.0 =
* New: Added Gutenberg blocks for Availability and Search Form as an alternative to shortcodes.
* New: Added dedicated block category for Hotel Booking for WooCommerce in the block inserter.
* Enhancement: Added server-side rendered block previews in the editor with shortcode-equivalent behavior.
* Enhancement: Added block support for wrapper alignment controls.
* Enhancement: Added editor-side styling support so block previews use plugin front-end styles.
* Fix: Prevented interactive form actions inside editor previews while keeping block selection and sidebar settings accessible.
* Compatibility: Kept existing shortcodes fully supported for backward compatibility.

= 1.0.45 =
* Refactor: Improved availability date-range processing performance and input safety.
* Fix: Corrected availability helper method naming with backward-compatible wrapper for Pro integrations.

= 1.0.44 =
* Fix: price formating error.

= 1.0.43 =
* Tested up to WooCommerce 10.5.3
* Improve: Accessibility of the mini cart on mobile (availability shortcode)
* Fix: Several JavaScript issues
* Fix: Warning related to the product amenities tab
* Fixed a typo in the constant name (PERCENT_BASE0 -> PERCENT_BASE)

= 1.0.42 =
* Tested up to WordPress 6.9.1
* Improved availability checks based on the current user cart
* Improved rate plan availability on both search and single product pages
* Moved accommodation information into its own product tab to keep the main content output clean

= 1.0.41 =
* Fix bug where method names were being replaced unintentionally

= 1.0.40 =
* Tested up to WooCommerce 10.4.3
* Added an option to show or hide unavailable rooms in availability search results.
* Improved calculation accuracy by using BCMath.
* Fixed several JavaScript issues.
* Improved custom add-on display in WooCommerce email templates.
* Improved the notice shown when rooms are unavailable for multiple dates.

= 1.0.32 =
* Bugfix: Fatal error on creating a new accommodation product. Thanks to [@shameemreza](https://wordpress.org/support/users/shameemreza/) | [topic](https://wordpress.org/support/topic/fatal-error-on-new-product-page-get_minimum_stay-called-before-product-type/)
* Bugfix: Missing initial "Minimum stay" field when add new rate to the product.

= 1.0.31 =
* Bugfix: Fix conditional check not working properly.

= 1.0.30 =
* Tested up to WooCommerce 10.4.2
* Enhancement: Moved "Minimum stay" option into the rate plan to support minimum stay per rate in the PRO version.
* Enhancement: Ensure tab navigation works correctly when popup appears.
* Enhancement: Product panel for rate plans.
* Deprecated: `get_minimum_stays` method.

= 1.0.20 =
* Tested up to WordPress 6.9
* Tested up to WooCommerce 10.3.6
* Bugfix: Removed the `the_content` filter from the rates description.
* Bugfix: Fixed an issue where the mini cart displayed an incorrect subtotal for certain currency configurations.
* Enhancement: When a product is set as Accommodation, ensure all stock options are configured correctly.

= 1.0.16 =
* Bugfix: Fatal error on single room page.

= 1.0.15 =
* Bugfix: Room data is wiped out after running Quick Edit.
* Enhancement: Use wc_format_decimal for better consistency.

= 1.0.14 =
* Bugfix: Price saving issue.  
* Bugfix: Booking addon issue in WC order creation (double brackets displayed in some installations).  
* Bugfix: Bulk availability update failure.  
* Bugfix: Booking mini cart now displays only accommodation products. 
* Enhancement: Set the default availability search to 1 night.

= 1.0.13 =
* Bugfix: Corrected rate price saving on the availability page for values greater than a thousand
* Enhancement: Remove unecesarry notices for PRO users.

= 1.0.12 =
* Bugfix: Room can now be added to cart on availability page even when no addon is selected.

= 1.0.11 =
* Dev: Added more action and filter hooks
* Bugfix: Corrected rate price saving for values greater than a thousand

= 1.0.10 =
* Tested up to WordPress 6.8.2.
* Tested up to WooCommerce 10.1.0.
* Bumped minimum PHP version to 8.0 for better performance and security.
* Relocated settings to WooCommerce → Settings → Hotel Booking.
* Enhancement: Refactored codebase for better maintainability.
* Bugfix: Inconsistent booking data when customers booked from different time zones.
* Bugfix: Ajax requests failed under heavy caching.

= 1.0.07 =
* Bugfix: Add-on prices were not correctly formatted.

= 1.0.06 =
* Tested up to WooCommerce 9.9.5  
* Enhancement – Improved calendar styling for unavailable dates  
* New – Booking add-on feature

= 1.0.03 =
* Tested with WordPress 6.8.1  
* Tested with WooCommerce 9.9.4  
* Enhancement: Merged CSS files to reduce confusion.
* Bugfix: Prevented double booking when using the WooCommerce checkout block.  
* Bugfix: Fixed room filtering issue when the selected number of children exceeds the room's allowed limit.
* Bugfix: Incorrect parameter used in related products filter.

= 1.0.02 =
* Tested with WordPress 6.8
* Tested with WooCommerce 9.8.1
* Enhancement: Setting Max Children = 0 disables child selection on the single product page
* Feature: Added configuration option to allow same-day bookings
* Bugfix: Unavailable dates are now correctly greyed out and non-selectable in the date picker
* Bugfix: Resolved issues with calendar localization/translation

= 1.0.01 =
* Tested with WordPress 6.7.2
* Tested with WooCommerce 9.7.1
* Fix: The date string is now translatable.

= 1.0.0 =
* Initial release.
