# WooCommerce Tier and Package Prices - Release 1.1.4

**Release Date:** December 21, 2025
**Version:** 1.1.4
**Package Size:** 394 KB
**Git Tag:** v1.1.4

## Download

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

### Checksums

**SHA256:**
```
19553b2fed1c6ca20a8168eab8c570cb0302be801322cd41d86cec40b70ff162
```

**MD5:**
```
3e5bc2cae17ecb81b729c3fdc979df23
```

## What's New in 1.1.4

This is an **enhancement release** that adds comprehensive WooCommerce Blocks support and improves the "View Options" button styling to match standard WooCommerce buttons.

### New Features
- **WooCommerce Blocks Support** - NEW
  - Full compatibility with block-based cart and mini-cart
  - Store API integration for quantity restrictions
  - Automatic quantity selector hiding in block contexts
  - Programmatic prevention of quantity editing via API

### Enhanced
- **"View Options" Button Styling**
  - Updated to match standard WooCommerce "Add to Cart" buttons
  - Proper padding (0.618em × 1em) following WooCommerce conventions
  - Bold font weight (700) for consistency
  - Smooth hover transitions with opacity effects
  - Professional appearance across all themes

### Bug Fixes
- WooCommerce blocks cart quantity selector now properly hidden for restricted products
- WooCommerce blocks mini-cart quantity selector visibility fixed
- Quantity editing prevented at Store API level for blocks

## What's Changed

### Added
- WooCommerce Blocks support for quantity restrictions
- `woocommerce_store_api_product_quantity_editable` filter for block-based carts
- `block_quantity_editable()` method in WC_TPP_Cart class
- CSS targeting for `.wc-block-components-quantity-selector` elements

### Enhanced
- "View Options" button styling to match standard WooCommerce "Add to Cart" buttons
- Button padding, font weight, and border radius for better visual consistency
- Hover effects with smooth transitions (0.2s ease)

### Fixed
- WooCommerce blocks cart quantity selector visibility for restricted products
- WooCommerce blocks mini-cart quantity selector visibility

### Technical
- Added Store API integration for block-based cart/mini-cart
- Enhanced CSS for block cart items with product-specific selectors
- Improved button styling with WooCommerce standard values (0.618em × 1em padding)
- Added transition effects for better UX
- Font weight: 700 (bold) for catalog buttons
- Border radius: 3px for rounded corners

## Installation

### New Installation

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

This is an **enhancement release** with WooCommerce Blocks support and improved styling.

**Steps:**
1. Deactivate version 1.1.3
2. Upload and activate version 1.1.4
3. All existing settings and data will be automatically preserved
4. No additional configuration required
5. WooCommerce Blocks cart/mini-cart now fully supported

### Upgrade from 1.1.2 or Earlier

Safe to upgrade directly. This version includes all features from v1.1.0, v1.1.1, v1.1.2, and v1.1.3 plus WooCommerce Blocks support.

**Steps:**
1. Deactivate the current version
2. Upload and activate version 1.1.4
3. All existing settings and data will be automatically preserved
4. Enjoy improved compatibility with modern WooCommerce features

### Requirements

- **WordPress:** 6.0 or higher
- **PHP:** 7.4 or higher
- **WooCommerce:** 8.0 or higher

## Complete Package Restriction Feature

The package quantity restriction feature now provides complete and reliable enforcement across ALL customer touchpoints, including modern WooCommerce Blocks:

### Catalog Pages (v1.1.2 + v1.1.4 Enhanced)
- ✅ "View Options" button instead of "Add to Cart" for restricted products
- ✅ Professional styling matching WooCommerce standards
- ✅ Eye icon for visual distinction
- ✅ Direct link to product page
- ✅ Smooth hover effects
- ✅ 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

### Classic Cart & Mini-Cart (v1.1.1 + v1.1.3)
- ✅ Quantity field hidden/replaced with read-only text
- ✅ Prevents cart quantity modification
- ✅ Consistent restriction enforcement
- ✅ No bypass via cart updates
- ✅ Works with all themes and plugins (high priority filters + CSS fallback)

### WooCommerce Blocks Cart & Mini-Cart (v1.1.4 - NEW)
- ✅ Store API integration prevents quantity editing
- ✅ `.wc-block-components-quantity-selector` hidden via CSS
- ✅ Product-specific targeting with data attributes
- ✅ Full compatibility with block-based cart blocks
- ✅ Full compatibility with block-based mini-cart blocks

### Settings
- ✅ Global setting to enable restrictions site-wide
- ✅ Per-product override for individual products
- ✅ Located in: WooCommerce > Settings > Tier & Package Prices

## Technical Implementation Details

### WooCommerce Blocks Integration (v1.1.4)

The implementation uses a multi-layered approach for maximum compatibility:

**Layer 1: Store API Filter**
```php
add_filter('woocommerce_store_api_product_quantity_editable', 'block_quantity_editable', 10, 2);

public function block_quantity_editable($editable, $cart_item) {
    $product_id = $cart_item['id'] ?? ($cart_item['product_id'] ?? 0);
    // Check restrictions...
    return false; // Make non-editable for restricted products
}
```

**Layer 2: CSS Hiding**
```css
.wc-block-cart-item[data-product-id="123"] .wc-block-components-quantity-selector,
.wc-block-mini-cart__items .wc-block-cart-item[data-product-id="123"] .wc-block-components-quantity-selector {
    display: none !important;
}
```

**Layer 3: Enhanced Button Styling**
```css
a.wc-tpp-view-options {
    padding: 0.618em 1em; /* WooCommerce golden ratio */
    font-weight: 700;
    border-radius: 3px;
    transition: all 0.2s ease;
}
```

This three-layer approach ensures compatibility with:
- ✅ Classic WooCommerce templates
- ✅ WooCommerce Blocks (Cart Block, Mini-Cart Block)
- ✅ All themes (inherits theme button colors)
- ✅ All cart/mini-cart variations

## Modified Files in 1.1.4

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

### PHP Classes Modified
- `includes/class-wc-tpp-cart.php` - Added WooCommerce Blocks support:
  - Added `woocommerce_store_api_product_quantity_editable` filter (line 22)
  - Added `block_quantity_editable()` method (lines 224-248)
  - Enhanced `add_cart_quantity_css()` with block selectors (lines 216-218)

### CSS Files Modified
- `assets/css/frontend.css` - Enhanced "View Options" button styling:
  - Added padding: 0.618em × 1em (line 168)
  - Added font-weight: 700 (line 167)
  - Added border-radius: 3px (line 170)
  - Added transition effects (line 172)
  - Added hover state (lines 186-189)

### Translation Files Updated
- `languages/wc-tier-package-prices.pot` - Version updated to 1.1.4
- `languages/wc-tier-package-prices-en_US.po` - Version updated to 1.1.4
- `languages/wc-tier-package-prices-de_DE.po` - Version updated to 1.1.4
- `languages/wc-tier-package-prices-de_CH_informal.po` - Version updated to 1.1.4
- 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 + v1.1.3)
- ✅ Catalog button modification (v1.1.2 + v1.1.4 enhanced)
- ✅ WooCommerce Blocks support (v1.1.4 - 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
- ✅ Professional "View Options" button (v1.1.4 enhanced)
- ✅ WooCommerce Blocks compatibility (v1.1.4 - NEW)

### Validation & Security
- ✅ Client-side JavaScript validation
- ✅ Server-side cart validation
- ✅ Cart quantity bypass prevention
- ✅ Catalog add-to-cart prevention
- ✅ Store API integration (v1.1.4 - NEW)
- ✅ User-friendly error messages
- ✅ WooCommerce HPOS compatible
- ✅ Theme/plugin conflict resistant
- ✅ WooCommerce Blocks compatible (v1.1.4 - NEW)

## Breaking Changes

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

## Migration Notes

### From 1.1.3
- No migration needed
- WooCommerce Blocks support is automatic
- Button styling improvements are automatic
- No new settings or configuration required

### From 1.1.2 or Earlier
- All v1.1.3 and v1.1.4 features included automatically
- Restriction features remain as configured
- WooCommerce Blocks now fully supported

### From 1.1.0 or Earlier
- All v1.1.1, v1.1.2, v1.1.3, and v1.1.4 features included
- Restriction features 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 inherits theme colors (not customizable separately)

### Future Enhancements
These features may be added in future versions:
- Customizable "View Options" button text and colors
- 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.4** (2025-12-21) - WooCommerce Blocks support + improved button styling
- **v1.1.3** (2025-12-21) - Cart quantity visibility bug fix
- **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

## User Impact

### Before v1.1.4
- WooCommerce Blocks cart/mini-cart showed quantity selectors for restricted products
- "View Options" button had basic styling, didn't match Add to Cart buttons well
- Potential confusion in stores using block-based cart

### After v1.1.4
- WooCommerce Blocks fully supported with quantity restrictions
- "View Options" button professionally styled to match WooCommerce standards
- Consistent user experience across classic and block-based carts
- Store API prevents programmatic quantity changes
- Visual consistency across all WooCommerce contexts

## Browser & Theme Compatibility

### Tested With
- ✅ Classic WooCommerce cart templates
- ✅ WooCommerce Cart Block
- ✅ WooCommerce Mini-Cart Block
- ✅ Storefront theme
- ✅ Twenty Twenty-Four theme
- ✅ Astra theme
- ✅ Kadence theme

### CSS Inheritance
The "View Options" button inherits colors from your theme's `.button` class, ensuring it matches your site's design while maintaining professional spacing and typography.

## Support

- **Documentation:** See README.md and CHANGELOG.md
- **Previous Release:** See RELEASE-INFO-1.1.3.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.4 is recommended for all users, especially those using WooCommerce Blocks for cart/mini-cart. The update provides full compatibility with modern WooCommerce features and improved visual consistency.
