A comprehensive Bed & Breakfast management system for WordPress. Manage buildings, rooms, bookings, and guests all within your WordPress admin.
## Description
WP BnB Management enables WordPress to act as a full management system for B&B hosts. It handles multiple buildings with multiple rooms each, bookings, and guest data required for room rentals.
### Key Features
- **Multi-Property Support**: Manage multiple buildings, each with multiple rooms
The plugin integrates with Contact Form 7 to accept booking requests and inquiries. Custom form tags are provided for room selection, date pickers, and guest counts.
### Custom Form Tags
Use these tags in your CF7 forms:
-`[bnb_building_select name]` - Building dropdown (optional filter for rooms)
-`[bnb_room_select* name]` - Room dropdown with capacity data
-`[bnb_date_checkin* name]` - Check-in date picker
-`[bnb_date_checkout* name]` - Check-out date picker
-`[bnb_guests* name]` - Guest count input
### Tag Options
**`[bnb_building_select]`**:
-`first_as_label:"text"` - Placeholder text (default: "All Locations")
**`[bnb_room_select]`**:
-`building_field:"name"` - Link to building field for filtering
-`first_as_label:"text"` - Placeholder text (default: "Select Room")
**`[bnb_guests]`**:
-`min:N` - Minimum guests (default: 1)
-`max:N` - Maximum guests (default: 10)
-`default:N` - Default value (default: 1)
### Example Booking Form
```txt
<div class="wp-bnb-booking-form">
<h3>Book Your Stay</h3>
<div class="wp-bnb-form-row">
[bnb_building_select building first_as_label:"All Locations"]
</div>
<div class="wp-bnb-form-row">
[bnb_room_select* room building_field:"building" first_as_label:"Select a Room"]
</div>
<div class="wp-bnb-form-row-2col">
<div class="wp-bnb-form-field">
<label>Check-in</label>
[bnb_date_checkin* check_in]
</div>
<div class="wp-bnb-form-field">
<label>Check-out</label>
[bnb_date_checkout* check_out]
</div>
</div>
<div class="wp-bnb-availability-status"></div>
<div class="wp-bnb-form-row">
<label>Number of Guests</label>
[bnb_guests* guests min:1 max:10 default:2]
</div>
<div class="wp-bnb-price-display"></div>
<h4>Your Information</h4>
<div class="wp-bnb-form-row-2col">
<div class="wp-bnb-form-field">
<label>First Name</label>
[text* first_name]
</div>
<div class="wp-bnb-form-field">
<label>Last Name</label>
[text* last_name]
</div>
</div>
<div class="wp-bnb-form-row">
<label>Email</label>
[email* your_email]
</div>
<div class="wp-bnb-form-row">
<label>Phone</label>
[tel your_phone]
</div>
<div class="wp-bnb-form-row">
<label>Message</label>
[textarea your_message]
</div>
[submit "Request Booking"]
</div>
```
### Example Inquiry Form
For room-specific inquiries, add the `wp-bnb-inquiry-form` class:
The plugin integrates with [WP Prometheus](https://src.bundespruefstelle.ch/magdev/wp-prometheus) to expose operational metrics for monitoring with Prometheus and Grafana.
### Enabling Metrics
1. Install and activate the WP Prometheus plugin
2. Navigate to **WP BnB → Settings → Metrics**
3. Enable "Expose BnB metrics via Prometheus"
4. Metrics will be available at your site's `/metrics/` endpoint
### Available Metrics
**Inventory Metrics:**
-`wp_bnb_buildings_total` - Total number of buildings
-`wp_bnb_rooms_total{status}` - Rooms by status (available, occupied, maintenance, inactive)
-`wp_bnb_services_total{status}` - Services by status (active, inactive)
-`wp_bnb_total_capacity_beds` - Total bed capacity across all rooms
**Booking Metrics:**
-`wp_bnb_bookings_total{status}` - Bookings by status (pending, confirmed, checked_in, checked_out, cancelled)
-`wp_bnb_checkins_today` - Check-ins scheduled for today
-`wp_bnb_checkouts_today` - Check-outs scheduled for today
-`wp_bnb_bookings_upcoming_7days` - Bookings starting in next 7 days
-`wp_bnb_booking_avg_duration_nights` - Average booking duration
**Occupancy Metrics:**
-`wp_bnb_occupancy_rate_current` - Current room occupancy rate (percentage)
-`wp_bnb_rooms_currently_occupied` - Rooms currently occupied
**Revenue Metrics:**
-`wp_bnb_revenue_this_month{currency}` - Revenue for current month
-`wp_bnb_revenue_ytd{currency}` - Revenue year to date
-`wp_bnb_booking_avg_value{currency}` - Average booking value
-`wp_bnb_services_revenue_this_month{currency}` - Services revenue this month
**Guest Metrics:**
-`wp_bnb_guests_total` - Total registered guests
-`wp_bnb_guests_by_status{status}` - Guests by status (active, blocked, vip)
-`wp_bnb_guests_repeat` - Guests with more than one booking
-`wp_bnb_guests_new_this_month` - New guests this month
### Grafana Dashboard
A pre-configured Grafana dashboard is included at `assets/grafana/wp-bnb-dashboard.json`. If WP Prometheus is installed, the dashboard is automatically registered and available for export.
The dashboard includes:
- Occupancy gauges with color-coded thresholds
- Bookings, rooms, and guests pie charts by status
- Dynamic pricing calculated from room rates and services
- Special checkout fields for arrival time and special requests
- Guest information pre-filled from user profile
**Booking Creation:**
- Bookings automatically created on successful payment
- Guest records created from billing information
- Booking linked to WooCommerce order for reference
- Booking reference displayed on order confirmation
**Order-Booking Synchronization:**
- Order status changes sync to booking status:
- Order completed → Booking confirmed
- Order cancelled → Booking cancelled
- Order refunded → Booking cancelled (full refund)
- Partial refunds recorded without cancellation
- Bidirectional linking between orders and bookings
**PDF Invoices:**
- Automatic PDF invoice generation
- Configurable invoice number prefix (default: `INV-`)
- Sequential invoice numbering with configurable start number
- Auto-attach to WooCommerce order emails
- Secure storage in `wp-content/uploads/wp-bnb-invoices/`
- Manual generation from order admin
### WooCommerce Settings
**General Subtab:**
- Enable/disable WooCommerce integration
- Enable automatic product sync
- Enable auto-attach invoices to emails
**Products Subtab:**
- View sync status and product count
- Manual "Sync All Rooms Now" button
- Product category assignment
**Orders Subtab:**
- Order-booking status mapping
- View linked orders and bookings
**Invoices Subtab:**
- Invoice number prefix
- Starting invoice number
- Company details for invoice header
- PDF styling options
### HPOS Compatibility
The integration is fully compatible with WooCommerce High-Performance Order Storage (HPOS). Order meta is accessed using the modern `$order->get_meta()` and `$order->update_meta_data()` methods.
### Admin Columns
- **Bookings list**: "WC Order" column with link to order
- **WooCommerce Orders list**: "Booking" column with link to booking
Yes, a valid license is required to use the frontend features in production. The admin functionality works without a license for evaluation purposes. Local development environments (localhost, .local, .test, .dev domains) automatically bypass license validation.
Yes! WooCommerce integration is available for payment processing and invoicing. Rooms are synced as virtual products, bookings are created on successful payment, and PDF invoices are auto-generated and attached to order emails. Navigate to **WP BnB → Settings → WooCommerce** to enable and configure the integration.
Sensitive guest data like passport/ID numbers are encrypted using AES-256-CBC encryption before storage. The encryption key is derived from your WordPress AUTH_KEY, ensuring data is secure at rest.
This plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version.