Release version 1.2.1 - Critical bugfixes for v1.2.0

Fixed two critical bugs introduced in v1.2.0:

1. Admin UI table structure mismatch - CSS still had flexbox styling from
   old template structure, breaking new table layout. Updated admin.css to
   properly style table rows with standard table cell padding.

2. Frontend pricing display not showing - Template was checking global
   enable settings before display. Removed those checks so pricing shows
   if configured on product AND display setting is enabled.

Files changed:
- wc-tier-and-package-prices.php - Version bump to 1.2.1
- composer.json - Version bump to 1.2.1
- CLAUDE.md - Updated version and documented fixes
- CHANGELOG.md - Added detailed v1.2.1 entry with root cause analysis
- assets/css/admin.css - Fixed table styling (removed flexbox)
- templates/frontend/pricing-table.twig - Removed global enable checks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-29 20:28:28 +01:00
parent 00c5b87aac
commit 6733ca5f98
6 changed files with 56 additions and 29 deletions

View File

@@ -5,6 +5,25 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.2.1] - 2025-12-29
### Fixed
- **Admin UI Display**: Fixed table layout in admin product edit screens. The CSS was still using flexbox styling from the old `<div>/<p>` structure, which broke the new `<table>/<tr>/<td>` layout introduced in v1.2.0. Updated `assets/css/admin.css` to properly style table rows with standard table cell padding and removed obsolete flexbox properties.
- **Frontend Pricing Display**: Fixed pricing tables not showing on simple product pages. Removed global "Enable Tier Pricing" and "Enable Package Pricing" checks from the frontend template (`templates/frontend/pricing-table.twig`). Pricing tables now display if configured on a product AND the "Display Pricing Table" setting is enabled, regardless of individual feature enable settings. Cart calculations still respect global enable settings for proper pricing application.
### Technical Details
**Root Cause - Admin UI Bug**: In v1.2.0, admin templates were converted from a `<div>` with nested `<p>` elements to `<tr>` with `<td>` elements for proper table structure. However, the CSS file (`assets/css/admin.css`) was not updated accordingly, leaving flexbox styling (`.wc-tpp-tier-row { display: flex; gap: 15px; ... }`) that conflicted with table display. This caused columns to not align with table headers.
**Root Cause - Frontend Display Bug**: The frontend pricing table template was checking both `get_option('wc_tpp_enable_tier_pricing')` AND `get_option('wc_tpp_enable_package_pricing')` before displaying pricing. This meant if these global settings were disabled (even though defaults are 'yes'), pricing configured on products wouldn't show. The better UX is: if pricing is configured AND display is enabled, show it. The global enable settings now only control cart calculation and admin UI visibility.
### Changed Files
- `assets/css/admin.css` - Replaced flexbox styling with table cell styling
- `templates/frontend/pricing-table.twig` - Removed global enable setting checks from display conditions
## [1.2.0] - 2025-12-29 ## [1.2.0] - 2025-12-29
### Added - Variable Product Support ### Added - Variable Product Support

View File

@@ -1,7 +1,7 @@
# WooCommerce Tier and Package Prices - AI Context Document # WooCommerce Tier and Package Prices - AI Context Document
**Last Updated:** 2025-12-29 **Last Updated:** 2025-12-29
**Current Version:** 1.2.0 **Current Version:** 1.2.1
**Author:** Marco Graetsch **Author:** Marco Graetsch
**Project Status:** Production-ready WordPress plugin **Project Status:** Production-ready WordPress plugin
@@ -558,7 +558,15 @@ Roadmap for the upcoming development.
#### Version 1.2.x #### Version 1.2.x
1. New Feature: Create different, selectable templates for tierprices and packages to use in the frontend. Make the new templates selectable globally on the settings-page, not per product. ##### Bugfixes (Completed in v1.2.1)
1. ~~The admin templates are not show right. The row templates didn't match the new table structure. The table-body columns didn't fit the table-head columns.~~**FIXED in v1.2.1** - Updated admin.css to remove flexbox styling that was breaking the new `<table>/<tr>/<td>` structure introduced in v1.2.0. The CSS was still using flexbox layout from the old `<div>/<p>` structure.
2. ~~The tier and package prices are not shown on simple product pages~~**FIXED in v1.2.1** - Removed global enable/disable checks from frontend template. Pricing tables now display if configured on a product AND the "Display Pricing Table" setting is enabled, regardless of "Enable Tier Pricing" or "Enable Package Pricing" global settings. Cart calculations still respect global enable settings.
##### New Features
1. Create different, selectable templates for tierprices and packages to use in the frontend. Make the new templates selectable globally on the settings-page, not per product.
### When Debugging Cart Issues ### When Debugging Cart Issues

View File

@@ -23,42 +23,41 @@
color: #666; color: #666;
} }
/* Table styling */
.wc-tpp-tiers-table,
.wc-tpp-packages-table {
margin-top: 15px;
margin-bottom: 15px;
}
.wc-tpp-tiers-table th,
.wc-tpp-packages-table th {
font-weight: 600;
text-align: left;
}
/* Table row styling - rows are now <tr> elements in a table */
.wc-tpp-tier-row, .wc-tpp-tier-row,
.wc-tpp-package-row { .wc-tpp-package-row {
display: flex; /* No special styling needed - standard table row */
gap: 15px;
align-items: flex-end;
padding: 15px;
background: #f9f9f9;
border: 1px solid #ddd;
border-radius: 4px;
margin-bottom: 10px;
} }
.wc-tpp-tier-row .form-field, .wc-tpp-tier-row td,
.wc-tpp-package-row .form-field { .wc-tpp-package-row td {
margin: 0; padding: 8px;
flex: 1; vertical-align: middle;
}
.wc-tpp-tier-row label,
.wc-tpp-package-row label {
display: block;
font-weight: 600;
margin-bottom: 5px;
} }
/* Ensure WooCommerce input classes work properly in table cells */
.wc-tpp-tier-row input, .wc-tpp-tier-row input,
.wc-tpp-package-row input { .wc-tpp-package-row input {
width: 100%; margin: 0;
} }
.wc-tpp-remove-tier, .wc-tpp-remove-tier,
.wc-tpp-remove-package { .wc-tpp-remove-package {
flex-shrink: 0;
color: #b32d2e; color: #b32d2e;
border-color: #b32d2e; border-color: #b32d2e;
margin-bottom: 0;
} }
.wc-tpp-remove-tier:hover, .wc-tpp-remove-tier:hover,

View File

@@ -1,7 +1,7 @@
{ {
"name": "magdev/wc-tier-package-prices", "name": "magdev/wc-tier-package-prices",
"description": "WooCommerce plugin for tier pricing and package prices with Twig templates", "description": "WooCommerce plugin for tier pricing and package prices with Twig templates",
"version": "1.2.0", "version": "1.2.1",
"type": "wordpress-plugin", "type": "wordpress-plugin",
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
"authors": [ "authors": [

View File

@@ -5,13 +5,14 @@
# @var object product # @var object product
# @var array tiers # @var array tiers
# @var array packages # @var array packages
# @var bool restrict_to_packages
#} #}
<div class="wc-tpp-pricing-container"> <div class="wc-tpp-pricing-container">
{% if tiers is not empty and get_option('wc_tpp_enable_tier_pricing') == 'yes' %} {% if tiers is not empty %}
{% include 'frontend/tier-pricing-table.twig' with {'product': product, 'tiers': tiers} %} {% include 'frontend/tier-pricing-table.twig' with {'product': product, 'tiers': tiers} %}
{% endif %} {% endif %}
{% if packages is not empty and get_option('wc_tpp_enable_package_pricing') == 'yes' %} {% if packages is not empty %}
{% include 'frontend/package-pricing-display.twig' with {'packages': packages, 'restrict_to_packages': restrict_to_packages|default(false)} %} {% include 'frontend/package-pricing-display.twig' with {'packages': packages, 'restrict_to_packages': restrict_to_packages|default(false)} %}
{% endif %} {% endif %}
</div> </div>

View File

@@ -4,7 +4,7 @@
* Plugin Name: WooCommerce Tier and Package Prices * Plugin Name: WooCommerce Tier and Package Prices
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wc-tier-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 * Description: Add tier pricing and package prices to WooCommerce products with configurable quantities at fixed prices
* Version: 1.2.0 * Version: 1.2.1
* Author: Marco Graetsch * Author: Marco Graetsch
* Author URI: https://src.bundespruefstelle.ch/magdev * Author URI: https://src.bundespruefstelle.ch/magdev
* Text Domain: wc-tier-package-prices * Text Domain: wc-tier-package-prices
@@ -23,7 +23,7 @@ if (!defined('ABSPATH')) {
// Define plugin constants // Define plugin constants
if (!defined('WC_TPP_VERSION')) { if (!defined('WC_TPP_VERSION')) {
define('WC_TPP_VERSION', '1.2.0'); define('WC_TPP_VERSION', '1.2.1');
} }
if (!defined('WC_TPP_PLUGIN_DIR')) { if (!defined('WC_TPP_PLUGIN_DIR')) {
define('WC_TPP_PLUGIN_DIR', plugin_dir_path(__FILE__)); define('WC_TPP_PLUGIN_DIR', plugin_dir_path(__FILE__));