diff --git a/CHANGELOG.md b/CHANGELOG.md index 959cdef..336444b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to WooCommerce Tier and Package Prices will be documented in 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.6] - 2025-12-21 + +### Fixed +- **CRITICAL:** Plugin activation fatal error in v1.1.3, v1.1.4, and v1.1.5 +- Fatal error caused by premature class instantiation before WooCommerce is loaded +- Removed immediate class instantiation from `class-wc-tpp-cart.php` and `class-wc-tpp-frontend.php` + +### Technical +- Moved `WC_TPP_Cart` and `WC_TPP_Frontend` instantiation to `woocommerce_loaded` hook +- Added `init_classes()` method to main plugin class for controlled class initialization +- Ensures WooCommerce is fully loaded before registering hooks that depend on WC functions +- Fixed hook registration timing to prevent accessing WooCommerce before it's available + ## [1.1.5] - 2025-12-21 ### Fixed diff --git a/composer.json b/composer.json index 577130e..2161249 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "magdev/wc-tier-package-prices", "description": "WooCommerce plugin for tier pricing and package prices with Twig templates", - "version": "1.1.5", + "version": "1.1.6", "type": "wordpress-plugin", "license": "GPL-2.0-or-later", "authors": [ diff --git a/includes/class-wc-tpp-cart.php b/includes/class-wc-tpp-cart.php index d334f7e..50fa6f0 100644 --- a/includes/class-wc-tpp-cart.php +++ b/includes/class-wc-tpp-cart.php @@ -247,5 +247,3 @@ class WC_TPP_Cart { return $editable; } } - -new WC_TPP_Cart(); diff --git a/includes/class-wc-tpp-frontend.php b/includes/class-wc-tpp-frontend.php index 3dc755c..b488dfc 100644 --- a/includes/class-wc-tpp-frontend.php +++ b/includes/class-wc-tpp-frontend.php @@ -182,5 +182,3 @@ class WC_TPP_Frontend { return $new_html; } } - -new WC_TPP_Frontend(); diff --git a/languages/wc-tier-package-prices-de_CH_informal.mo b/languages/wc-tier-package-prices-de_CH_informal.mo index e3767a8..3692735 100644 Binary files a/languages/wc-tier-package-prices-de_CH_informal.mo and b/languages/wc-tier-package-prices-de_CH_informal.mo differ diff --git a/languages/wc-tier-package-prices-de_CH_informal.po b/languages/wc-tier-package-prices-de_CH_informal.po index 8fb6239..ac951f6 100644 --- a/languages/wc-tier-package-prices-de_CH_informal.po +++ b/languages/wc-tier-package-prices-de_CH_informal.po @@ -3,7 +3,7 @@ # This file is distributed under the GPL v2 or later. msgid "" msgstr "" -"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.5\n" +"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.6\n" "Report-Msgid-Bugs-To: https://src.bundespruefstelle.ch/wc-tier-package-prices\n" "POT-Creation-Date: 2025-12-21 00:00+0000\n" "PO-Revision-Date: 2025-12-21 00:00+0000\n" diff --git a/languages/wc-tier-package-prices-de_DE.mo b/languages/wc-tier-package-prices-de_DE.mo index c6eb948..659503b 100644 Binary files a/languages/wc-tier-package-prices-de_DE.mo and b/languages/wc-tier-package-prices-de_DE.mo differ diff --git a/languages/wc-tier-package-prices-de_DE.po b/languages/wc-tier-package-prices-de_DE.po index 5e1fd76..3ff4418 100644 --- a/languages/wc-tier-package-prices-de_DE.po +++ b/languages/wc-tier-package-prices-de_DE.po @@ -3,7 +3,7 @@ # This file is distributed under the GPL v2 or later. msgid "" msgstr "" -"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.5\n" +"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.6\n" "Report-Msgid-Bugs-To: https://src.bundespruefstelle.ch/wc-tier-package-prices\n" "POT-Creation-Date: 2025-12-21 00:00+0000\n" "PO-Revision-Date: 2025-12-21 00:00+0000\n" diff --git a/languages/wc-tier-package-prices-en_US.mo b/languages/wc-tier-package-prices-en_US.mo index 1688963..36526ff 100644 Binary files a/languages/wc-tier-package-prices-en_US.mo and b/languages/wc-tier-package-prices-en_US.mo differ diff --git a/languages/wc-tier-package-prices-en_US.po b/languages/wc-tier-package-prices-en_US.po index 9c21c85..c697bfb 100644 --- a/languages/wc-tier-package-prices-en_US.po +++ b/languages/wc-tier-package-prices-en_US.po @@ -3,7 +3,7 @@ # This file is distributed under the GPL v2 or later. msgid "" msgstr "" -"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.5\n" +"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.6\n" "Report-Msgid-Bugs-To: https://src.bundespruefstelle.ch/wc-tier-package-prices\n" "POT-Creation-Date: 2025-12-21 00:00+0000\n" "PO-Revision-Date: 2025-12-21 00:00+0000\n" diff --git a/languages/wc-tier-package-prices.pot b/languages/wc-tier-package-prices.pot index a44a67a..28620c0 100644 --- a/languages/wc-tier-package-prices.pot +++ b/languages/wc-tier-package-prices.pot @@ -2,7 +2,7 @@ # This file is distributed under the GPL v2 or later. msgid "" msgstr "" -"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.5\n" +"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.6\n" "Report-Msgid-Bugs-To: https://src.bundespruefstelle.ch/wc-tier-package-prices\n" "POT-Creation-Date: 2025-12-21 00:00+0000\n" "MIME-Version: 1.0\n" diff --git a/releases/wc-tier-and-package-prices-1.1.5.zip b/releases/wc-tier-and-package-prices-1.1.5.zip new file mode 100644 index 0000000..e580f4f Binary files /dev/null and b/releases/wc-tier-and-package-prices-1.1.5.zip differ diff --git a/releases/wc-tier-and-package-prices-1.1.5.zip.md5 b/releases/wc-tier-and-package-prices-1.1.5.zip.md5 new file mode 100644 index 0000000..9aef704 --- /dev/null +++ b/releases/wc-tier-and-package-prices-1.1.5.zip.md5 @@ -0,0 +1 @@ +e9f8a69e4be107d857d3beb671d5a9fe wc-tier-and-package-prices-1.1.5.zip diff --git a/releases/wc-tier-and-package-prices-1.1.5.zip.sha256 b/releases/wc-tier-and-package-prices-1.1.5.zip.sha256 new file mode 100644 index 0000000..e8cfdd5 --- /dev/null +++ b/releases/wc-tier-and-package-prices-1.1.5.zip.sha256 @@ -0,0 +1 @@ +a13d71f3f65c7cf41613f88d7bcfcb112acfefb800fa6b95932f44a47cf764f3 wc-tier-and-package-prices-1.1.5.zip diff --git a/wc-tier-and-package-prices.php b/wc-tier-and-package-prices.php index 81b8312..4949a1d 100644 --- a/wc-tier-and-package-prices.php +++ b/wc-tier-and-package-prices.php @@ -4,7 +4,7 @@ * Plugin Name: WooCommerce Tier and Package Prices * Plugin URI: https://src.bundespruefstelle.ch/wc-tier-package-prices * Description: Add tier pricing and package prices to WooCommerce products with configurable quantities at fixed prices - * Version: 1.1.5 + * Version: 1.1.6 * Author: Marco Graetsch * Author URI: https://src.bundespruefstelle.ch/magdev * Text Domain: wc-tier-package-prices @@ -22,7 +22,7 @@ if (!defined('ABSPATH')) { } // Define plugin constants -define('WC_TPP_VERSION', '1.1.5'); +define('WC_TPP_VERSION', '1.1.6'); define('WC_TPP_PLUGIN_DIR', plugin_dir_path(__FILE__)); define('WC_TPP_PLUGIN_URL', plugin_dir_url(__FILE__)); define('WC_TPP_PLUGIN_BASENAME', plugin_basename(__FILE__)); @@ -78,6 +78,14 @@ class WC_Tier_Package_Prices { require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-product-meta.php'; require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-frontend.php'; require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-cart.php'; + + // Instantiate classes after WooCommerce is loaded + add_action('woocommerce_loaded', array($this, 'init_classes')); + } + + public function init_classes() { + new WC_TPP_Frontend(); + new WC_TPP_Cart(); } public function declare_hpos_compatibility() {