Release version 1.1.2 - Catalog button modification

Enhanced package quantity restriction enforcement by replacing "Add to Cart"
buttons with "View Options" links on catalog pages for products with
quantity restrictions. This prevents customers from attempting to add
restricted products directly from shop/category pages.

Changes:
- Added catalog button modification for restricted products
- Implemented "View Options" button with eye icon styling
- Created has_quantity_restriction() helper method
- Extended CSS loading to all WooCommerce pages
- Added modify_catalog_add_to_cart_button() filter method
- Updated translations with 2 new strings (en_US, de_DE, de_CH_informal)

🤖 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-21 19:04:41 +01:00
parent 3e06137559
commit 4ece4dd69e
17 changed files with 434 additions and 9 deletions

View File

@@ -0,0 +1,272 @@
# WooCommerce Tier and Package Prices - Release 1.1.1
**Release Date:** December 21, 2025
**Version:** 1.1.1
**Package Size:** 403 KB
**Git Tag:** v1.1.1
## Download
**File:** `wc-tier-and-package-prices-1.1.1.zip`
### Checksums
**SHA256:**
```
b951f8b7ddd2bad6b3415d4583709fdf88f66aea4eae70110c903757ff53e045
```
**MD5:**
```
51c4f8a7c3ccede2d2005f2fe3ebe44e
```
## What's New in 1.1.1
This is a **patch release** that enhances the package quantity restriction feature introduced in v1.1.0 by preventing cart quantity bypass.
### Security Enhancement
- **Fixed:** Cart quantity bypass vulnerability for package-restricted products
- Customers could previously modify quantities in the cart to bypass package restrictions
- This patch ensures restrictions are enforced throughout the entire purchase flow
### New Features
- **Cart Quantity Field Hiding** - NEW
- Automatic hiding of quantity input field in cart when restrictions are enabled
- Cart displays quantity as read-only text for restricted products
- Prevents manual quantity modification in shopping cart
- Seamless integration with existing restriction settings
### Technical Improvements
- Added `maybe_hide_cart_quantity_input()` method in WC_TPP_Cart class
- Extended `woocommerce_cart_item_quantity` filter hook
- New CSS class: `wc-tpp-cart-quantity` for styled quantity display
- Enhanced cart validation and display consistency
## What's Changed
### Added
- Cart quantity field hiding when package restriction is enabled
- Automatic read-only quantity display in cart for restricted products
### Changed
- Cart quantity input replaced with plain text when restrictions apply
- Enhanced cart display to prevent quantity modification for restricted products
### Fixed
- Cart quantity bypass vulnerability for package-restricted products
## Installation
### New Installation
1. Download the ZIP file: `wc-tier-and-package-prices-1.1.1.zip`
2. Log in to your WordPress admin panel
3. Navigate to **Plugins > Add New > Upload Plugin**
4. Choose the downloaded ZIP file
5. Click **Install Now**
6. After installation, click **Activate Plugin**
7. Go to **WooCommerce > Settings > Tier & Package Prices** to configure
### Upgrade from 1.1.0
This is a **patch release** with a security fix. No configuration changes needed.
**Steps:**
1. Deactivate version 1.1.0
2. Upload and activate version 1.1.1
3. All existing settings and data will be automatically preserved
4. No additional configuration required
### Upgrade from 1.0.x
Safe to upgrade directly. This version includes all features from v1.1.0 plus the cart quantity hiding enhancement.
**Steps:**
1. Deactivate the current version
2. Upload and activate version 1.1.1
3. All existing settings and data will be automatically preserved
4. Review the new package restriction features if desired
### Requirements
- **WordPress:** 6.0 or higher
- **PHP:** 7.4 or higher
- **WooCommerce:** 8.0 or higher
## Complete Package Restriction Feature (v1.1.0 + v1.1.1)
The package quantity restriction feature now provides complete enforcement across all touchpoints:
### Product Page (v1.1.0)
- ✅ Quantity field automatically hidden when restriction enabled
- ✅ "Choose a package size below" notice displayed
- ✅ Visual package selection with highlighted states
- ✅ JavaScript validation prevents form submission without package selection
### Add to Cart Validation (v1.1.0)
- ✅ Server-side validation on add-to-cart
- ✅ User-friendly error messages showing available package sizes
- ✅ Prevents manual quantity manipulation via form fields
### Cart Page (v1.1.1 - NEW)
- ✅ Quantity field hidden/replaced with read-only text
- ✅ Prevents cart quantity modification
- ✅ Consistent restriction enforcement
- ✅ No bypass via cart updates
### Settings
- ✅ Global setting to enable restrictions site-wide
- ✅ Per-product override for individual products
- ✅ Located in: WooCommerce > Settings > Tier & Package Prices
## Use Cases
### Scenario 1: Bulk-Only Sales
Enable restriction globally to sell products only in bulk quantities.
**Example:**
- Package 1: 100 units at $500
- Package 2: 250 units at $1,100
- Package 3: 500 units at $2,000
Customers can only purchase these exact quantities on both product page and in cart.
### Scenario 2: Sample Packs
Create fixed sample packs with no custom quantities.
**Example:**
- Starter Pack: 10 items
- Trial Pack: 25 items
- Full Pack: 50 items
Quantity cannot be changed in cart - customers must return to product page to select a different package.
### Scenario 3: Promotional Bundles
Offer promotional pricing only for specific bundle sizes with no modifications allowed.
**Example:**
- Holiday Bundle: 12 units (seasonal pricing)
- Party Pack: 24 units (bulk discount)
- Wholesale Bundle: 100 units (wholesale pricing)
## Modified Files in 1.1.1
### Core Files Updated
- `wc-tier-and-package-prices.php` - Version updated to 1.1.1
- `composer.json` - Version updated to 1.1.1
- `CHANGELOG.md` - Added v1.1.1 section
### PHP Classes Modified
- `includes/class-wc-tpp-cart.php` - Added `maybe_hide_cart_quantity_input()` method
### Translation Files Updated
- `languages/wc-tier-package-prices.pot` - Version updated to 1.1.1
- `languages/wc-tier-package-prices-en_US.po` - Version updated to 1.1.1
- `languages/wc-tier-package-prices-de_DE.po` - Version updated to 1.1.1
- `languages/wc-tier-package-prices-de_CH_informal.po` - Version updated to 1.1.1
## Complete Feature Set
### Tier Pricing
- ✅ Quantity-based discount tiers
- ✅ Automatic price calculation
- ✅ Volume discount display
### Package Pricing
- ✅ Fixed-price bundles
- ✅ Custom package labels
- ✅ Multiple package options per product
- ✅ Quantity restriction to packages only (v1.1.0)
- ✅ Cart quantity enforcement (v1.1.1 - NEW)
### Admin Features
- ✅ WooCommerce Settings integration
- ✅ Easy-to-use product meta boxes
- ✅ Configurable display positions
- ✅ Native WooCommerce UI
- ✅ Global restriction setting
- ✅ Per-product restriction override
### Frontend Features
- ✅ Beautiful pricing tables (Twig templates)
- ✅ Real-time cart updates
- ✅ Responsive design
- ✅ 3 languages supported
- ✅ Package-only selection mode
- ✅ Automatic quantity field hiding (product page & cart)
- ✅ Visual package selection
- ✅ Read-only cart quantity display (NEW)
### Validation & Security
- ✅ Client-side JavaScript validation
- ✅ Server-side cart validation
- ✅ Cart quantity bypass prevention (NEW)
- ✅ User-friendly error messages
- ✅ WooCommerce HPOS compatible
## Breaking Changes
**None.** This release is fully backward compatible with v1.1.0 and v1.0.x.
## Migration Notes
### From 1.1.0
- No migration needed
- Cart quantity hiding is automatic when restrictions are enabled
- No new settings or configuration required
### From 1.0.x
- All v1.1.0 features included plus cart enhancement
- New restriction features are disabled by default
- Must be explicitly enabled in settings
### Settings Location
All settings remain in: **WooCommerce > Settings > Tier & Package Prices**
### Data Preservation
- All existing tier pricing data preserved
- All existing package pricing data preserved
- All product meta data preserved
- No database changes required
## Known Limitations
### Current Version
1. Restriction only works when packages are defined
2. Cannot restrict to tier quantities (only packages)
3. Restriction applies to entire product (no variation-level control)
4. Cart quantity is read-only text (not a dropdown of package options)
### Future Enhancements
These features may be added in future versions:
- Cart package quantity dropdown selector
- Variation-level restriction control
- Restrict to tier quantities option
- Minimum/maximum package selection limits
## Changelog Summary
### Version History
- **v1.1.1** (2025-12-21) - Cart quantity bypass fix
- **v1.1.0** (2025-12-21) - Package quantity restriction feature
- **v1.0.2** (2025-12-21) - WooCommerce Settings integration
- **v1.0.1** (2025-12-21) - Twig template engine integration
- **v1.0.0** (2025-12-21) - Initial release
## Support
- **Documentation:** See README.md and CHANGELOG.md
- **Previous Release:** See RELEASE-INFO-1.1.0.md
- **Issues:** https://src.bundespruefstelle.ch/wc-tier-package-prices/issues
- **Author:** Marco Graetsch
## License
GPL v2 or later - https://www.gnu.org/licenses/gpl-2.0.html
---
**Production Ready:** This package includes optimized autoloader and no development dependencies.
**Recommended Update:** Version 1.1.1 is recommended for all users of v1.1.0 to ensure complete package restriction enforcement. Users on v1.0.x can safely upgrade to gain both the restriction feature and this security enhancement.