Files
wc-composable-product/CHANGELOG.md
magdev f1382490ec Fix Settings.php class loading timing issue (v1.1.2)
CRITICAL BUG FIX: v1.1.1 still had the same error!

Root cause analysis:
- v1.1.1 changed hook to woocommerce_init but error persisted
- Real issue: Settings.php was require_once'd in Plugin::includes()
- At that point, class extends WC_Settings_Page which doesn't exist yet
- Even woocommerce_init fires before WC_Settings_Page is loaded

Solution:
- Removed require_once from Plugin::includes() (line 93)
- Moved require_once to Plugin::add_settings_page() (line 196)
- Settings.php now loads on-demand via woocommerce_get_settings_pages filter
- This filter fires when WooCommerce has loaded all settings classes

Changes:
- includes/Plugin.php: Delayed Settings.php inclusion with explanatory comment
- wc-composable-product.php: Version bump to 1.1.2
- CHANGELOG.md: Documented fix and noted v1.1.1 was insufficient

This addresses the actual root cause that persisted through 3 versions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 16:59:17 +01:00

111 lines
4.1 KiB
Markdown

# Changelog
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).
## [1.1.2] - 2024-12-31
### Fixed
- **CRITICAL**: Fixed persistent "Class WC_Settings_Page not found" error that continued in v1.1.1
- Root cause: Settings.php was being included too early (during plugin init) before WC_Settings_Page was loaded
- Solution: Delayed Settings.php inclusion until `woocommerce_get_settings_pages` filter when class is guaranteed to exist
### Technical
- Removed `require_once Settings.php` from `Plugin::includes()` (line 93)
- Added `require_once Settings.php` to `Plugin::add_settings_page()` (line 196)
- Settings file now loads on-demand when WooCommerce requests settings pages
- Previous hook change (woocommerce_init) was insufficient - class loading order was the real issue
### Notes
- v1.1.1 attempted to fix this with hook change but the error persisted
- This version addresses the actual root cause: premature class extension
## [1.1.1] - 2024-12-31
### Fixed
- Settings page initialization timing issue causing "Class WC_Settings_Page not found" error
- Changed hook from `woocommerce_loaded` to `woocommerce_init` to ensure WC_Settings_Page class is available
- Plugin now initializes after all WooCommerce core classes are loaded
### Technical
- Hook changed from `woocommerce_loaded` to `woocommerce_init` in wc-composable-product.php:65
- `woocommerce_init` fires after WooCommerce has finished loading all its core classes including settings
## [1.1.0] - 2024-12-31
### Added
- **Stock Management Integration**: Complete inventory tracking system for composable products
- Stock validation during product selection and add-to-cart
- Automatic stock deduction when orders are completed/processed
- Automatic stock restoration on order cancellation/refund
- Stock status indicators in product selector (In stock, Low stock, Out of stock)
- Visual feedback for out-of-stock items (disabled checkboxes, reduced opacity)
- Low stock warnings when 5 or fewer items remain
- Prevention of out-of-stock item selection
- Order notes documenting stock changes
### Technical
- New `Stock_Manager` class handling all stock operations
- Integration with WooCommerce order status hooks
- Stock information passed to frontend via Twig template
- Enhanced CSS styling for stock status badges
- Stock data stored in order item meta for accurate tracking
- Backorder support detection and handling
### Translation
- Added 8 new translatable strings for stock messages
- Updated Italian (Switzerland) translation with stock-related terms
- Updated translation template (.pot file)
## [1.0.1] - 2024-12-31
### Fixed
- Fatal error "Class WC_Settings_Page not found" during plugin activation
- Changed initialization hook from `plugins_loaded` to `woocommerce_loaded` to ensure WooCommerce classes are available before plugin initialization
- Settings page now correctly integrates as a tab in WooCommerce > Settings
### Technical
- Plugin now waits for `woocommerce_loaded` action before initializing
- Prevents race condition where WooCommerce classes weren't loaded yet
- Settings tab appears correctly in WooCommerce settings interface
## [1.0.0] - 2024-12-31
### Added
- Initial release
- Composable product type for WooCommerce
- Product selection by category, tag, or SKU
- Configurable selection limits (global and per-product)
- Two pricing modes: fixed price or sum of selected products
- Admin settings page
- Frontend product selector with grid layout
- AJAX add-to-cart functionality
- Twig template engine integration
- Full internationalization support
- Responsive design
- WooCommerce cart integration
- Product data validation
### Features
- Select products from predefined categories, tags, or SKUs
- Limit number of items customers can select
- Visual product selector with images and prices
- Real-time price calculation
- Clean, modern UI
- Mobile responsive
- Translation ready
[1.0.0]: https://github.com/magdev/wc-composable-product/releases/tag/v1.0.0