Release version 1.2.9 - Translation and deletion fixes

## Bugfixes

1. **Price Header Not Translated**
   - Fixed translation function placement in printf statements
   - Changed from printf(__()) to printf(esc_html__())
   - Headers now display in administrator's configured language

2. **Placeholder HTML Entity Encoding**
   - Currency symbols were showing as HTML entities (e.g., €)
   - Removed translation filter from concatenated placeholder strings
   - Placeholders are example values that should not be translated

3. **Variation Pricing Still Not Deletable (Regression)**
   - Despite v1.2.8 fix, edge cases remained due to conditional branching
   - Refactored save logic to be more defensive
   - Always initializes arrays, then unconditionally updates or deletes
   - Guarantees proper cleanup regardless of POST data structure

## Technical Details

- Updated all 6 table headers: printf(esc_html__('Price (%s)', 'wc-tier-package-prices'), ...)
- Removed |__() filter from Twig placeholder concatenations
- Refactored save_variation_pricing_fields() with simplified logic:
  * Initialize arrays at start
  * Populate only if valid POST data exists
  * Always perform update (if !empty) or delete (if empty)
- Added is_array() check for extra safety

## Changed Files

- includes/class-wc-tpp-product-meta.php
- templates/admin/tier-row.twig
- templates/admin/package-row.twig

🤖 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-30 05:02:50 +01:00
parent d71f2c01dc
commit 0f5779dc56
7 changed files with 105 additions and 29 deletions

View File

@@ -21,7 +21,7 @@
<input type="text"
name="{{ name_prefix }}[{{ index|esc_attr }}][price]"
value="{{ tier.price|default('')|esc_attr }}"
placeholder="{{ ('e.g., 9.99 ' ~ currency_symbol)|__('wc-tier-package-prices') }}"
placeholder="{{ 'e.g., 9.99 ' ~ currency_symbol }}"
class="short wc_input_price">
</td>
<td>