From 7520a37b050fe2bfce2a156fd0ed3e54a25a8761 Mon Sep 17 00:00:00 2001 From: magdev Date: Wed, 31 Dec 2025 16:50:35 +0100 Subject: [PATCH] Fix WC_Settings_Page class loading issue (v1.1.1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Critical bug fix for settings page initialization: - Changed hook from woocommerce_loaded to woocommerce_init - woocommerce_loaded fires before WC_Settings_Page is loaded - woocommerce_init ensures all WooCommerce core classes are available This resolves the "Class WC_Settings_Page not found" fatal error that prevented the plugin from activating successfully. Version bumped from 1.1.0 to 1.1.1 (patch release). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- CHANGELOG.md | 13 +++++++++++++ wc-composable-product.php | 8 ++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 086d74c..98a35a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ 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.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 diff --git a/wc-composable-product.php b/wc-composable-product.php index 1a45637..6098f04 100644 --- a/wc-composable-product.php +++ b/wc-composable-product.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Composable Products * Plugin URI: https://github.com/magdev/wc-composable-product * Description: Create composable products where customers select a limited number of items from a configurable set - * Version: 1.1.0 + * Version: 1.1.1 * Author: Marco Graetsch * Author URI: https://example.com * License: GPL v3 or later @@ -19,7 +19,7 @@ defined('ABSPATH') || exit; // Define plugin constants -define('WC_COMPOSABLE_PRODUCT_VERSION', '1.1.0'); +define('WC_COMPOSABLE_PRODUCT_VERSION', '1.1.1'); define('WC_COMPOSABLE_PRODUCT_FILE', __FILE__); define('WC_COMPOSABLE_PRODUCT_PATH', plugin_dir_path(__FILE__)); define('WC_COMPOSABLE_PRODUCT_URL', plugin_dir_url(__FILE__)); @@ -61,8 +61,8 @@ function wc_composable_product_init() { // Initialize main plugin class WC_Composable_Product\Plugin::instance(); } -// Use woocommerce_loaded to ensure WooCommerce classes are available -add_action('woocommerce_loaded', 'wc_composable_product_init'); +// Use woocommerce_init to ensure all WooCommerce classes including settings are loaded +add_action('woocommerce_init', 'wc_composable_product_init'); /** * Activation hook