Hotel Booking System
Complete hotel booking system for WordPress with room management, availability calendar, and online booking support
by Kaito2013 · github.com/kaito2013/hotel-booking-wordpress · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/kaito2013/hotel-booking-wordpress/archive/refs/heads/main.zipHotel Booking WordPress Plugin
Complete hotel booking system for WordPress with room management, availability calendar, pricing, online booking, and payment integration (Stripe & PayPal).
Features
Core Features
- Room Management: Custom post type for hotel rooms with detailed information
- Availability Management: Real-time availability tracking and calendar view
- Pricing Management: Flexible pricing with date-based rules and adjustments
- Booking System: Complete booking workflow with status management
- Payment Integration: Stripe and PayPal payment gateways
- Notification System: Email notifications for booking confirmations and updates
- Admin Dashboard: Statistics and booking overview
- Calendar View: Visual availability calendar for all rooms
- REST API: Full REST API for frontend integration
Admin Features
- Dashboard with key statistics
- Booking management and status updates
- Room availability calendar
- Payment settings and configuration
- Email notification settings
- Taxonomy management for room types and amenities
Frontend Features
- Room search with date and guest filters
- Room list with availability and pricing
- Room detail page with gallery and amenities
- Real-time price calculation
- Online booking form with validation
- Payment processing (Stripe & PayPal)
- Booking confirmation page with full details
- My Bookings page for booking history
- Booking cancellation with email notification
- Mini calendar for availability
- Responsive mobile-friendly design
User Features
- View booking history
- Cancel pending bookings
- Download booking receipts (coming soon)
- Contact support information
- Email confirmations and reminders
Requirements
- WordPress 6.4+
- PHP 8.0+
- MySQL 5.7+
Installation
Manual Installation
- Download the plugin zip file
- Go to WordPress Admin → Plugins → Add New → Upload Plugin
- Select the zip file and click "Install Now"
- Activate the plugin
Installation from GitHub
cd wp-content/plugins/
git clone https://github.com/Kaito2013/hotel-booking-wordpress.git hotel-booking
Then activate the plugin from WordPress admin.
Setup
1. Create Rooms
- Go to Hotel Booking → Rooms → Add New
- Enter room details:
- Title: Room name
- Description: Room description
- Room Image: Featured image
- Room Capacity: Number of guests
- Room Price: Base price per night
- Room Size: Size in sq ft/m
- Number of Beds: Bed count
- Select room type and amenities
- Publish
2. Configure Settings
Go to Hotel Booking → Settings:
General Settings
- Currency: Select your currency
- Default Check-in Time: Set default check-in time
- Default Check-out Time: Set default check-out time
Payment Settings
Stripe:
- Enable Stripe
- Set test mode or live mode
- Enter your Stripe API keys
- Save settings
PayPal:
- Enable PayPal
- Set test mode or live mode
- Enter your PayPal API credentials
- Save settings
Email Settings
- Enable/disable confirmation emails
- Enable/disable reminder emails
- Enable/disable cancellation emails
- Enable/disable admin notifications
3. Integrate with Frontend
Use the REST API to integrate with your theme or custom frontend:
Get Available Rooms
fetch('/wp-json/hotel-booking/v1/rooms?check_in=2024-05-01&check_out=2024-05-05&guests=2')
.then(response => response.json())
.then(data => console.log(data.rooms));
Check Availability
fetch('/wp-json/hotel-booking/v1/availability?room_id=123&check_in=2024-05-01&check_out=2024-05-05')
.then(response => response.json())
.then(data => console.log(data.available));
Calculate Price
fetch('/wp-json/hotel-booking/v1/pricing?room_id=123&check_in=2024-05-01&check_out=2024-05-05')
.then(response => response.json())
.then(data => console.log(data.price));
Create Booking
fetch('/wp-json/hotel-booking/v1/bookings', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
room_id: 123,
check_in: '2024-05-01',
check_out: '2024-05-05',
guests: 2,
first_name: 'John',
last_name: 'Doe',
email: 'john@example.com',
phone: '+1234567890',
payment_method: 'stripe',
})
})
.then(response => response.json())
.then(data => console.log(data));
Database Schema
The plugin creates three custom database tables:
wp_hb_availability
Stores room availability by date:
id: Primary keyroom_id: Room IDcheck_in: Check-in datecheck_out: Check-out datestatus: Status (available/booked)booking_id: Associated booking IDcreated_at: Creation timestamp
wp_hb_pricing
Stores room pricing by date:
id: Primary keyroom_id: Room IDstart_date: Price start dateend_date: Price end dateprice: Price per nightmin_nights: Minimum nightsmax_nights: Maximum nightscreated_at: Creation timestamp
wp_hb_bookings
Stores booking information:
id: Primary keyroom_id: Room IDuser_id: User ID (if logged in)first_name: Guest first namelast_name: Guest last nameemail: Guest emailphone: Guest phonecheck_in: Check-in datecheck_out: Check-out dateguests: Number of gueststotal_price: Total booking pricepayment_method: Payment method (stripe/paypal)payment_status: Payment status (pending/completed/failed)payment_id: Payment transaction IDbooking_status: Booking status (pending/confirmed/cancelled/completed)notes: Booking notescreated_at: Creation timestampupdated_at: Last update timestamp
REST API Endpoints
Rooms
GET /wp-json/hotel-booking/v1/rooms- Get all rooms (with filters)GET /wp-json/hotel-booking/v1/rooms/{id}- Get room by ID
Availability
GET /wp-json/hotel-booking/v1/availability- Check room availability
Pricing
GET /wp-json/hotel-booking/v1/pricing- Calculate booking price
Bookings
POST /wp-json/hotel-booking/v1/bookings- Create new bookingGET /wp-json/hotel-booking/v1/bookings/{id}- Get booking by ID (requires login)
Settings
GET /wp-json/hotel-booking/v1/settings- Get public settings
Custom Post Types
hb_room
Hotel rooms with the following metadata:
_hb_room_capacity: Room capacity (number of guests)_hb_room_price: Base price per night_hb_room_size: Room size_hb_room_beds: Number of beds_hb_pricing_rules: Pricing rules array
hb_booking
Bookings (admin view only)
Taxonomies
room_type
Hierarchical taxonomy for room types (e.g., Standard, Deluxe, Suite)
room_amenity
Non-hierarchical taxonomy for room amenities (e.g., WiFi, AC, TV, Pool)
Hooks and Filters
Actions
hb_booking_created- Fired after booking is createdhb_booking_status_updated- Fired when booking status changeshb_payment_status_updated- Fired when payment status changes
Usage Example
add_action( 'hb_booking_created', 'my_custom_booking_handler', 10, 2 );
function my_custom_booking_handler( $booking_id, $data ) {
// Do something with the booking
error_log( "New booking created: #$booking_id" );
}
Payment Gateways
Stripe
- Requires Stripe PHP SDK
- Supports Payment Intents API
- Test mode and live mode
- Webhook handling
PayPal
- Requires PayPal PHP SDK
- Supports Orders API
- Test mode and live mode
- Webhook handling
Security
- All user inputs are sanitized
- Nonce verification for AJAX requests
- SQL injection prevention with prepared statements
- XSS protection with escaping
- Capability checks for admin actions
Performance
- Optimized database queries with proper indexing
- Availability pre-generation for 365 days
- Caching-ready architecture
- Lazy loading for room images
Testing
The plugin includes:
- Unit tests structure (in
/tests/directory) - REST API test endpoints
- Admin interface tests
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Changelog
1.0.0 (2024-04-18)
- Initial release
- Room management system
- Availability calendar
- Pricing management
- Booking system
- Stripe integration
- PayPal integration
- Email notifications
- Admin dashboard
- REST API
- Frontend search and booking
License
GPL-2.0+
Support
For support, please open an issue on GitHub or contact the author.
Credits
Developed by Kaito2013
Donate
If you find this plugin useful, please consider donating to support continued development.
Note: This is an MVP release. More features coming soon including:
- Multi-language support
- Advanced reporting
- Coupon codes
- Seasonal pricing
- Room add-ons
- Reviews and ratings
- Frontend shortcode/widgets
- WooCommerce integration