Add WooCommerce integration for payments, invoices, and order management (v0.11.0)
All checks were successful
Create Release Package / build-release (push) Successful in 1m11s

- Product sync: Virtual WC products for rooms with bidirectional linking
- Cart/Checkout: Booking data in cart items, availability validation, dynamic pricing
- Orders: Automatic booking creation on payment, status mapping, guest record creation
- Invoices: PDF generation via mPDF, auto-attach to emails, configurable numbering
- Refunds: Full refund cancels booking, partial refund records amount only
- Admin: Cross-linked columns and row actions between bookings and orders
- Settings: WooCommerce tab with subtabs (General, Products, Orders, Invoices)
- HPOS compatibility declared for High-Performance Order Storage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 22:40:36 +01:00
parent 965060cc03
commit 2865956c56
15 changed files with 5036 additions and 9 deletions

View File

@@ -5,6 +5,76 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.11.0] - 2026-02-03
### Added
- WooCommerce Integration System:
- New `src/Integration/WooCommerce/` directory with complete integration
- `Manager.php` - Core integration manager with HPOS compatibility declaration
- `ProductSync.php` - Room-to-WooCommerce-product synchronization
- `CartHandler.php` - Cart item data, availability validation, dynamic pricing
- `CheckoutHandler.php` - Checkout field customization and pre-fill
- `OrderHandler.php` - Booking creation on payment completion
- `InvoiceGenerator.php` - PDF invoice generation using mPDF
- `RefundHandler.php` - Booking cancellation on full refund
- `AdminColumns.php` - Admin list cross-links between bookings and orders
- Product Synchronization:
- Virtual WooCommerce products created for rooms (SKU: `bnb-room-{id}`)
- Auto-sync on room save, delete on room deletion
- Manual "Sync All Rooms" button in settings
- Bidirectional meta linking (room ↔ product)
- Cart & Checkout:
- Booking data stored in cart items (room, dates, guests, services)
- Availability validation before add-to-cart and at checkout
- Dynamic price calculation based on dates and services
- Cart item display shows booking details (dates, guests, nights)
- Special requests and arrival time fields at checkout
- Booking summary display in checkout and order received page
- Order & Booking Integration:
- Automatic booking creation on `woocommerce_payment_complete`
- Guest record creation from order billing info
- Bidirectional order-booking links via meta keys
- Status synchronization (WC status → Booking status mapping)
- Booking reference generation (BNB-YYYY-NNNNN)
- Invoice Generation:
- PDF invoices using existing mPDF dependency
- Invoice numbering with configurable prefix and start number
- Auto-attach invoices to WooCommerce order emails
- Download invoice button in admin order actions
- Secure storage in `wp-content/uploads/wp-bnb-invoices/`
- Refund Handling:
- Full refund triggers booking cancellation
- Partial refund stores amount in booking meta without cancellation
- Refund info displayed in booking admin
- `wp_bnb_wc_should_cancel_on_refund` filter for customization
- Admin Enhancements:
- "WC Order" column in bookings list with order link and status
- "Booking" column in WC orders list with dates and status
- Row actions for cross-navigation between bookings and orders
- HPOS (High-Performance Order Storage) support
- WooCommerce Settings Tab with Subtabs:
- General: Enable integration, auto-confirm on payment, WC status indicator
- Products: Auto-sync toggle, product category selection, sync button
- Orders: Status mapping reference table
- Invoices: Auto-attach, prefix, starting number, logo, footer text
- Frontend Assets:
- `assets/css/wc-integration.css` - Cart, checkout, and booking form styles
- `assets/js/wc-integration.js` - Booking form handler, AJAX operations
### Changed
- Plugin.php updated to initialize WooCommerce integration when WC is active
- Settings page now has eight tabs: General, Pricing, License, Updates, Metrics, API, WooCommerce
- HPOS compatibility declared via `FeaturesUtil::declare_compatibility()`
### Security
- Invoice storage protected with .htaccess (deny all)
- Nonce verification on all AJAX operations
- Capability checks for admin actions
- HPOS-compatible meta access using `$order->get_meta()` / `$order->update_meta_data()`
## [0.10.1] - 2026-02-03
### Added
@@ -634,6 +704,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Input sanitization and output escaping
- Server secret masking in license settings
[0.11.0]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.11.0
[0.10.1]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.10.1
[0.10.0]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.10.0
[0.9.0]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.9.0
[0.8.0]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.8.0
[0.7.2]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.7.2
[0.7.1]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.7.1
[0.7.0]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.7.0
[0.6.1]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.6.1
[0.6.0]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.6.0
[0.5.0]: https://src.bundespruefstelle.ch/magdev/wp-bnb/releases/tag/v0.5.0