You've already forked wc-composable-product
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>
This commit is contained in:
20
CHANGELOG.md
20
CHANGELOG.md
@@ -5,6 +5,26 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user