You've already forked wc-tier-and-package-prices
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db9ba2bacd | |||
| e46372da51 |
42
CHANGELOG.md
42
CHANGELOG.md
@@ -5,6 +5,48 @@ 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.18] - 2025-12-22
|
||||
|
||||
### Fixed
|
||||
|
||||
- **ROOT CAUSE IDENTIFIED**: Settings page rendering twice due to automatic instantiation in settings file
|
||||
- Settings file being included multiple times via Composer autoloader creating duplicate instances
|
||||
|
||||
### Changed
|
||||
|
||||
- Removed `return new WC_TPP_Settings();` from bottom of settings file
|
||||
- Changed admin class to explicitly instantiate settings with `new WC_TPP_Settings()`
|
||||
- Changed from `include` to `require_once` for settings file to prevent multiple loads
|
||||
|
||||
### Technical Details
|
||||
|
||||
- Settings file (class-wc-tpp-settings.php) was creating instance automatically on include
|
||||
- File is in Composer's classmap, so when autoloaded it executed instantiation again
|
||||
- Each include/autoload created new instance even with singleton pattern in admin class
|
||||
- Solution: Remove automatic instantiation, use `require_once` + explicit `new` in admin class
|
||||
- Now settings instance only created once, explicitly, when needed by filter
|
||||
- Composer autoload can load class definition without side effects
|
||||
|
||||
## [1.1.17] - 2025-12-22
|
||||
|
||||
### Fixed
|
||||
|
||||
- Settings page still rendering twice despite singleton pattern in v1.1.16
|
||||
- Filter adding settings instance to array multiple times when called repeatedly
|
||||
|
||||
### Changed
|
||||
|
||||
- Added duplicate detection in `add_settings_page()` filter method
|
||||
- Filter now checks if settings instance already exists in array before adding
|
||||
|
||||
### Technical Details
|
||||
|
||||
- Added foreach loop to check existing settings pages in array
|
||||
- Uses strict comparison (`===`) to detect if exact instance already present
|
||||
- Returns early if settings instance found, preventing duplicate array entries
|
||||
- Complements singleton pattern from v1.1.16 with array-level duplicate prevention
|
||||
- Handles edge case where WooCommerce calls filter multiple times
|
||||
|
||||
## [1.1.16] - 2025-12-22
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -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.16",
|
||||
"version": "1.1.18",
|
||||
"type": "wordpress-plugin",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"authors": [
|
||||
|
||||
@@ -30,8 +30,17 @@ if (!class_exists('WC_TPP_Admin')) {
|
||||
*/
|
||||
public function add_settings_page($settings) {
|
||||
if (null === self::$settings_instance) {
|
||||
self::$settings_instance = include WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-settings.php';
|
||||
require_once WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-settings.php';
|
||||
self::$settings_instance = new WC_TPP_Settings();
|
||||
}
|
||||
|
||||
// Check if our settings page is already in the array to prevent duplicates
|
||||
foreach ($settings as $settings_page) {
|
||||
if ($settings_page === self::$settings_instance) {
|
||||
return $settings;
|
||||
}
|
||||
}
|
||||
|
||||
$settings[] = self::$settings_instance;
|
||||
return $settings;
|
||||
}
|
||||
|
||||
@@ -141,5 +141,3 @@ if (!class_exists('WC_TPP_Settings')) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new WC_TPP_Settings();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Plugin Name: WooCommerce Tier and Package Prices
|
||||
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wc-tier-package-prices
|
||||
* Description: Add tier pricing and package prices to WooCommerce products with configurable quantities at fixed prices
|
||||
* Version: 1.1.16
|
||||
* Version: 1.1.18
|
||||
* Author: Marco Graetsch
|
||||
* Author URI: https://src.bundespruefstelle.ch/magdev
|
||||
* Text Domain: wc-tier-package-prices
|
||||
@@ -23,7 +23,7 @@ if (!defined('ABSPATH')) {
|
||||
|
||||
// Define plugin constants
|
||||
if (!defined('WC_TPP_VERSION')) {
|
||||
define('WC_TPP_VERSION', '1.1.16');
|
||||
define('WC_TPP_VERSION', '1.1.18');
|
||||
}
|
||||
if (!defined('WC_TPP_PLUGIN_DIR')) {
|
||||
define('WC_TPP_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
||||
|
||||
Reference in New Issue
Block a user