You've already forked wc-tier-and-package-prices
**CRITICAL FIX:** Restored plugin to working state after v1.1.8-1.1.13 were completely non-functional. **Root Cause:** - v1.1.8 moved class instantiation from individual files to init_classes() method - v1.1.13 wrapped classes in class_exists() guards - Combination prevented any classes from being instantiated - Result: No settings, no frontend, no backend functionality **Solution:** - Reverted to v1.1.2 pattern (last working version) - Each class file now instantiates itself with `new ClassName();` - Removed init_classes() method and woocommerce_loaded hook - All class_exists() guards remain for redeclaration protection **What Now Works:** ✅ WooCommerce Settings → Tier & Package Prices tab ✅ Product edit pages show tier/package pricing meta boxes ✅ Frontend displays pricing tables on product pages ✅ Cart applies tier/package pricing correctly ✅ All plugin functionality fully operational **Files Modified:** - includes/class-wc-tpp-admin.php - includes/class-wc-tpp-product-meta.php - includes/class-wc-tpp-frontend.php - includes/class-wc-tpp-cart.php - wc-tier-and-package-prices.php (removed init_classes) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
36 lines
1.0 KiB
PHP
36 lines
1.0 KiB
PHP
<?php
|
|
/**
|
|
* Admin settings and configuration
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
if (!class_exists('WC_TPP_Admin')) {
|
|
class WC_TPP_Admin {
|
|
|
|
public function __construct() {
|
|
add_filter('woocommerce_get_settings_pages', array($this, 'add_settings_page'));
|
|
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
|
|
}
|
|
|
|
/**
|
|
* Add settings page to WooCommerce settings
|
|
*/
|
|
public function add_settings_page($settings) {
|
|
$settings[] = include WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-settings.php';
|
|
return $settings;
|
|
}
|
|
|
|
public function enqueue_admin_scripts($hook) {
|
|
if ('woocommerce_page_wc-settings' === $hook || 'post.php' === $hook || 'post-new.php' === $hook) {
|
|
wp_enqueue_style('wc-tpp-admin', WC_TPP_PLUGIN_URL . 'assets/css/admin.css', array(), WC_TPP_VERSION);
|
|
wp_enqueue_script('wc-tpp-admin', WC_TPP_PLUGIN_URL . 'assets/js/admin.js', array('jquery'), WC_TPP_VERSION, true);
|
|
}
|
|
}
|
|
}
|
|
|
|
new WC_TPP_Admin();
|
|
}
|