You've already forked wc-tier-and-package-prices
Release version 1.1.5 - Critical bug fix for plugin activation
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user