# WooCommerce Tier and Package Prices - Release 1.1.2

**Release Date:** December 21, 2025
**Version:** 1.1.2
**Package Size:** 405 KB
**Git Tag:** v1.1.2

## Download

**File:** `wc-tier-and-package-prices-1.1.2.zip`

### Checksums

**SHA256:**
```
40ffd29ebc6af635f689472040acd220ae1c8df2f0d852fab4b43ce0fb5fe739
```

**MD5:**
```
eee69fcf391b3f3df9380306ffb31b1b
```

## What's New in 1.1.2

This is a **patch release** that completes the package quantity restriction feature by preventing catalog page add-to-cart attempts for restricted products.

### New Features
- **Catalog "View Options" Button** - NEW
  - "Add to Cart" buttons replaced with "View Options" links on shop/category/archive pages
  - Eye icon (Dashicons) styling for visual distinction
  - Direct link to product page for package selection
  - Prevents customer confusion from attempting invalid cart additions

### Enhanced User Experience
- Products with quantity restrictions now clearly indicate "View Options" instead of "Add to Cart"
- Customers are guided to product page where they must select a valid package
  - No more failed add-to-cart attempts from catalog pages
- Consistent restriction enforcement across all touchpoints

### Technical Improvements
- Added `has_quantity_restriction()` static helper method in WC_TPP_Frontend class
- Added `modify_catalog_add_to_cart_button()` method in WC_TPP_Frontend class
- Extended `woocommerce_loop_add_to_cart_link` filter hook
- Updated CSS loading to all WooCommerce pages (shop, cart, checkout, product)
- New CSS classes: `wc-tpp-view-options`, `wc-tpp-cart-quantity`, `wc-tpp-restriction-notice`

## What's Changed

### Added
- Catalog "View Options" button for products with quantity restrictions
- Automatic button replacement in shop/category/archive pages
- Eye icon (Dashicons) for "View Options" button styling

### Changed
- "Add to Cart" button replaced with "View Options" link on catalog pages for restricted products
- CSS now loads on all WooCommerce pages (shop, cart, checkout, product)
- Catalog buttons now direct to product page instead of adding to cart

### Translations
- Added 2 new translatable strings:
  - "View Options" → "Optionen ansehen" (German)
  - "View options for %s" → "Optionen für %s ansehen" (German)
- Updated all translations (en_US, de_DE, de_CH_informal)
- Compiled all .mo files with new strings

## Installation

### New Installation

1. Download the ZIP file: `wc-tier-and-package-prices-1.1.2.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.1

This is a **patch release** with improved user experience. No configuration changes needed.

**Steps:**
1. Deactivate version 1.1.1
2. Upload and activate version 1.1.2
3. All existing settings and data will be automatically preserved
4. No additional configuration required

### Upgrade from 1.1.0 or Earlier

Safe to upgrade directly. This version includes all features from v1.1.0 and v1.1.1 plus catalog button enhancements.

**Steps:**
1. Deactivate the current version
2. Upload and activate version 1.1.2
3. All existing settings and data will be automatically preserved
4. Review the 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 + v1.1.2)

The package quantity restriction feature now provides complete enforcement across all customer touchpoints:

### Catalog Pages (v1.1.2 - NEW)
- ✅ "View Options" button instead of "Add to Cart" for restricted products
- ✅ Eye icon for visual distinction
- ✅ Direct link to product page
- ✅ Prevents invalid add-to-cart attempts from shop/category pages

### 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)
- ✅ 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

## User Flow Comparison

### Before v1.1.2
**Shop Page:** "Add to Cart" button → **Result:** Ajax add fails with error OR quantity validation error

### After v1.1.2
**Shop Page:** "View Options" button → **Product Page:** Select package → **Add to Cart:** Success

The improved flow eliminates customer confusion and failed add-to-cart attempts.

## Use Cases

### Scenario 1: Bulk-Only Product Catalog
Enable restriction globally. Shop pages show "View Options" for all products.

**Customer Experience:**
- Browse shop → See "View Options" on bulk products
- Click "View Options" → Product page opens
- Select from available packages (e.g., 100, 250, 500 units)
- Add to cart → Success with no errors

### Scenario 2: Mixed Catalog
Some products restricted, others not. Shop page shows appropriate buttons.

**Customer Experience:**
- Browse shop → See mix of "Add to Cart" and "View Options"
- Regular products: "Add to Cart" works normally
- Restricted products: "View Options" → Product page → Package selection

### Scenario 3: Sample Pack Products
Products sold only in fixed sample packs.

**Customer Experience:**
- Browse samples → All show "View Options"
- Click button → Product page shows package choices
- Select "Starter Pack (10)", "Trial Pack (25)", or "Full Pack (50)"
- Quantity cannot be modified in cart

## Modified Files in 1.1.2

### Core Files Updated
- `wc-tier-and-package-prices.php` - Version updated to 1.1.2
- `composer.json` - Version updated to 1.1.2
- `CHANGELOG.md` - Added v1.1.2 section

### PHP Classes Modified
- `includes/class-wc-tpp-frontend.php` - Added catalog button modification methods

### CSS Files Modified
- `assets/css/frontend.css` - Added `.wc-tpp-view-options` button styling, eye icon

### Translation Files Updated
- `languages/wc-tier-package-prices.pot` - Version updated to 1.1.2, 2 new strings
- `languages/wc-tier-package-prices-en_US.po` - Version updated, 2 new strings
- `languages/wc-tier-package-prices-de_DE.po` - Version updated, 2 new strings
- `languages/wc-tier-package-prices-de_CH_informal.po` - Version updated, 2 new strings
- All `.mo` files recompiled

## 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)
- ✅ Catalog button modification (v1.1.2 - 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
- ✅ Catalog "View Options" button (NEW)

### Validation & Security
- ✅ Client-side JavaScript validation
- ✅ Server-side cart validation
- ✅ Cart quantity bypass prevention
- ✅ Catalog add-to-cart prevention (NEW)
- ✅ User-friendly error messages
- ✅ WooCommerce HPOS compatible

## Breaking Changes

**None.** This release is fully backward compatible with v1.1.1, v1.1.0 and v1.0.x.

## Migration Notes

### From 1.1.1
- No migration needed
- Catalog button changes are automatic when restrictions are enabled
- No new settings or configuration required

### From 1.1.0 or Earlier
- All v1.1.1 and v1.1.2 features included automatically
- 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)
5. "View Options" button uses standard WooCommerce button styling

### Future Enhancements
These features may be added in future versions:
- Customizable "View Options" button text
- 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.2** (2025-12-21) - Catalog button modification
- **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.1.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.2 is recommended for all users to provide the best customer experience when using package quantity restrictions. The catalog button modification eliminates customer confusion and failed add-to-cart attempts.
