From 9765c5f1194a2a3829593dc0776d07804faa2f8d Mon Sep 17 00:00:00 2001 From: magdev Date: Sun, 21 Dec 2025 19:49:24 +0100 Subject: [PATCH] Release version 1.1.5 - Critical bug fix for plugin activation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CRITICAL FIX: Resolved fatal error that prevented plugin activation in versions 1.1.3 and 1.1.4. The add_cart_quantity_css() method was attempting to access WooCommerce cart object during wp_head action, causing failures when WooCommerce wasn't fully initialized or on admin pages. Fixes: - Plugin activation error in v1.1.3 and v1.1.4 - Fatal error when WooCommerce cart object not available - Frontend errors on admin pages - Issues during plugin initialization Technical Changes: - Added function_exists('WC') check before accessing WooCommerce - Added is_admin() check to prevent CSS injection on admin pages - Enhanced add_cart_quantity_css() with proper guards - Line 191: if (!function_exists('WC') || !WC()->cart || is_admin()) Root Cause: The add_cart_quantity_css() method (added in v1.1.3) hooks into wp_head but didn't properly check if WooCommerce cart was available, causing errors during plugin activation and on admin pages. Updated Files: - includes/class-wc-tpp-cart.php (enhanced error checking) - wc-tier-and-package-prices.php (version 1.1.5) - composer.json (version 1.1.5) - CHANGELOG.md (v1.1.5 section) - All translation files (.pot, .po, .mo) updated to version 1.1.5 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- CHANGELOG.md | 12 ++++++++++++ composer.json | 2 +- includes/class-wc-tpp-cart.php | 2 +- .../wc-tier-package-prices-de_CH_informal.mo | Bin 5377 -> 5377 bytes .../wc-tier-package-prices-de_CH_informal.po | 2 +- languages/wc-tier-package-prices-de_DE.mo | Bin 5350 -> 5350 bytes languages/wc-tier-package-prices-de_DE.po | 2 +- languages/wc-tier-package-prices-en_US.mo | Bin 5247 -> 5247 bytes languages/wc-tier-package-prices-en_US.po | 2 +- languages/wc-tier-package-prices.pot | 2 +- wc-tier-and-package-prices.php | 4 ++-- 11 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 633b94d..959cdef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ 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.5] - 2025-12-21 + +### Fixed +- **CRITICAL:** Plugin activation error in v1.1.3 and v1.1.4 caused by `add_cart_quantity_css()` method +- Fatal error when WooCommerce cart object not available during plugin initialization +- Frontend errors on admin pages and during activation + +### Technical +- Added `function_exists('WC')` check before accessing WooCommerce functions +- Added `is_admin()` check to prevent CSS injection on admin pages +- Enhanced error prevention in `add_cart_quantity_css()` method + ## [1.1.4] - 2025-12-21 ### Added diff --git a/composer.json b/composer.json index 34a4dbf..577130e 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.4", + "version": "1.1.5", "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 f2a9d2e..d334f7e 100644 --- a/includes/class-wc-tpp-cart.php +++ b/includes/class-wc-tpp-cart.php @@ -188,7 +188,7 @@ class WC_TPP_Cart { public function add_cart_quantity_css() { // Get all cart items and check which products have restrictions - if (!WC()->cart) { + if (!function_exists('WC') || !WC()->cart || is_admin()) { return; } diff --git a/languages/wc-tier-package-prices-de_CH_informal.mo b/languages/wc-tier-package-prices-de_CH_informal.mo index c4057a142fa5ddfd6a964720056b030e697ca6f6..e3767a83bbaf0de264261ca7e22f46c3245647a7 100644 GIT binary patch delta 14 VcmZqFYSh~Bo}1Bh^9OE0P5>!~1pfd4 delta 14 VcmZqFYSh~Bo}1BR^9OE0P5>!^1pWX3 diff --git a/languages/wc-tier-package-prices-de_CH_informal.po b/languages/wc-tier-package-prices-de_CH_informal.po index 0bfbe8c..8fb6239 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.4\n" +"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.5\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 519e6d29b78588f34b66928e51b79759c8b16f37..c6eb948678fdb828826d0e0519c670b56d8aeeea 100644 GIT binary patch delta 14 WcmaE+`Al=edu~S4%^$eGaR2}{dIqZi delta 14 WcmaE+`Al=edu~RP%^$eGaR2}{bOx#b diff --git a/languages/wc-tier-package-prices-de_DE.po b/languages/wc-tier-package-prices-de_DE.po index df9e7c3..5e1fd76 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.4\n" +"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.5\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 053659f9f4c5533d19f69200e9059bb4e1bf7cbe..1688963cabce3d1d92cb89130f8f3a5e786896d0 100644 GIT binary patch delta 14 Vcmeyb@n2)Zdu~S4%^$e?IRG~v26O-b delta 14 Vcmeyb@n2)Zdu~RP%^$e?IRG~p26F%a diff --git a/languages/wc-tier-package-prices-en_US.po b/languages/wc-tier-package-prices-en_US.po index f7b3053..9c21c85 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.4\n" +"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.5\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 e50faf0..a44a67a 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.4\n" +"Project-Id-Version: WooCommerce Tier and Package Prices 1.1.5\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/wc-tier-and-package-prices.php b/wc-tier-and-package-prices.php index e441515..81b8312 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.4 + * Version: 1.1.5 * 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.4'); +define('WC_TPP_VERSION', '1.1.5'); 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__));