You've already forked wc-tier-and-package-prices
Release version 1.2.0 - Add complete variable product support
This major feature release adds full support for WooCommerce variable products with variation-level pricing configuration. ## Key Features - Each product variation can have independent tier and package pricing - AJAX-based dynamic pricing table loading on variation selection - Admin UI integrated into WooCommerce variation panels - Full backward compatibility with existing simple product functionality - WooCommerce Blocks compatibility maintained ## Implementation Highlights - Effective ID pattern throughout codebase for variation handling - Variation-specific meta boxes with field prefix support - Template system updated to support both simple and variation products - JavaScript enhancements for variation selector integration - Cart logic updated to handle variation pricing correctly ## Files Changed - Core: wc-tier-and-package-prices.php (version 1.2.0), composer.json - Cart: includes/class-wc-tpp-cart.php (effective ID logic) - Frontend: includes/class-wc-tpp-frontend.php (AJAX endpoint, variation detection) - Admin: includes/class-wc-tpp-product-meta.php (variation hooks and methods) - Templates: templates/admin/*.twig (field prefix support, table structure) - JavaScript: assets/js/*.js (variation support) - Documentation: CHANGELOG.md, README.md, CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
90
CHANGELOG.md
90
CHANGELOG.md
@@ -5,6 +5,96 @@ 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.2.0] - 2025-12-29
|
||||
|
||||
### Added - Variable Product Support
|
||||
|
||||
**Major Feature**: Complete support for WooCommerce variable products with variation-level pricing
|
||||
|
||||
- Variable products can now have tier and package pricing configured independently for each variation
|
||||
- Admin UI: Each variation displays tier/package pricing fields in the variation edit panel
|
||||
- Frontend: Pricing tables load dynamically via AJAX when customer selects a variation
|
||||
- Cart: Variation-specific pricing correctly applied during checkout
|
||||
- Quantity restrictions work per-variation (not just per-product)
|
||||
- Catalog buttons: "View Options" appears for variable products with restricted variations
|
||||
|
||||
### Changed
|
||||
|
||||
- **Admin Templates**: Converted tier/package row templates from `<div>` to `<tr>` table structure for better layout
|
||||
- **Admin UI**: Simple product pricing fields now use table layout for consistency with variations
|
||||
- **Frontend Display**: Variable products show placeholder container; pricing appears on variation selection
|
||||
- **Cart Logic**: All cart methods now use "effective ID" pattern (variation ID when present, product ID otherwise)
|
||||
- **Template System**: Added `field_prefix` parameter support to admin templates for variation field naming
|
||||
|
||||
### Technical Details
|
||||
|
||||
#### Backend Changes
|
||||
|
||||
- **class-wc-tpp-cart.php**: Added variation ID resolution throughout; updated all meta lookups to use effective ID
|
||||
- **class-wc-tpp-frontend.php**:
|
||||
- Updated `get_tier_price()` and `get_package_price()` to accept `variation_id` parameter
|
||||
- Added AJAX endpoint `ajax_get_variation_pricing()` for fetching variation pricing data
|
||||
- Updated `display_pricing_table()` to detect variable products and show placeholder
|
||||
- Fixed `modify_catalog_add_to_cart_button()` to check variations for restrictions
|
||||
- **class-wc-tpp-product-meta.php**:
|
||||
- Added hooks: `woocommerce_variation_options_pricing`, `woocommerce_save_product_variation`
|
||||
- New method: `add_variation_pricing_fields()` - renders pricing UI in variation panels
|
||||
- New method: `save_variation_pricing_fields()` - saves variation-specific pricing data
|
||||
- New methods: `render_variation_tier_row()`, `render_variation_package_row()` - variation rendering helpers
|
||||
|
||||
#### Frontend Changes
|
||||
|
||||
- **frontend.js**:
|
||||
- Added variation selector integration listening to `found_variation` and `reset_data` events
|
||||
- Implemented AJAX fetching of variation pricing when variation selected
|
||||
- Dynamic quantity restriction handling per-variation
|
||||
- Re-initialization of event handlers for dynamically loaded pricing tables
|
||||
- **admin.js**:
|
||||
- Separated simple product and variation handlers
|
||||
- Variation-specific add/remove tier/package row management
|
||||
- Context-aware template selection using variation loop index
|
||||
|
||||
#### Template Changes
|
||||
|
||||
- **tier-row.twig**: Added `field_prefix` variable for variation field naming; changed to `<tr>` structure
|
||||
- **package-row.twig**: Added `field_prefix` variable for variation field naming; changed to `<tr>` structure
|
||||
|
||||
#### Data Storage
|
||||
|
||||
- Meta keys remain the same: `_wc_tpp_tiers`, `_wc_tpp_packages`, `_wc_tpp_restrict_to_packages`
|
||||
- Simple products: Stored on product post meta
|
||||
- Variations: Stored on variation post meta (independent per-variation)
|
||||
|
||||
### Backward Compatibility
|
||||
|
||||
- **100% backward compatible** - No breaking changes
|
||||
- Simple products continue working exactly as before
|
||||
- Existing tier/package data unaffected
|
||||
- No database migrations required
|
||||
- Templates remain compatible (field_prefix optional)
|
||||
|
||||
### Migration Notes
|
||||
|
||||
- Existing installations can upgrade seamlessly
|
||||
- Variable products simply gain new functionality
|
||||
- No action required for existing simple product configurations
|
||||
|
||||
### Performance Considerations
|
||||
|
||||
- AJAX requests only made when variation selected (not on page load)
|
||||
- Pricing data fetched per-variation (not all variations at once)
|
||||
- Nonce verification on all AJAX requests for security
|
||||
- Template rendering server-side for SEO/performance
|
||||
|
||||
### Testing Performed
|
||||
|
||||
- Simple products: All existing functionality verified
|
||||
- Variable products: Tier pricing, package pricing, restrictions tested per-variation
|
||||
- Mixed carts: Simple + variable products working correctly
|
||||
- WooCommerce Blocks: Cart block, mini-cart block, checkout block compatibility verified
|
||||
- Admin UI: Add/remove rows working for both simple products and variations
|
||||
- Quantity restrictions: Enforced correctly per-variation in cart and checkout
|
||||
|
||||
## [1.1.22] - 2025-12-23
|
||||
|
||||
### Changed
|
||||
|
||||
Reference in New Issue
Block a user