Release version 1.1.0 - Package quantity restriction feature

Added comprehensive package quantity restriction functionality that allows
limiting product purchases to predefined package sizes only.

Features:
- Global setting to enable package quantity restrictions
- Per-product override for quantity restrictions
- Automatic hiding of quantity input field when restricted
- Frontend validation with package selection UI
- Server-side cart validation
- User-friendly error messages
- Complete translations for all supported languages

🤖 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 15:54:04 +01:00
parent dea2c5f0b3
commit e0a32821ee
22 changed files with 699 additions and 54 deletions

View File

@@ -3,13 +3,17 @@
#
# @package WC_Tier_Package_Prices
# @var array packages
# @var bool restrict_to_packages
#}
<div class="wc-tpp-package-pricing-table">
<div class="wc-tpp-package-pricing-table{% if restrict_to_packages %} wc-tpp-restricted-mode{% endif %}">
<h3>{{ 'Package Deals'|__('wc-tier-package-prices') }}</h3>
{% if restrict_to_packages %}
<p class="wc-tpp-restriction-notice">{{ 'Choose a package size below'|__('wc-tier-package-prices') }}</p>
{% endif %}
<div class="wc-tpp-packages">
{% for index, package in packages %}
{% set price_per_unit = package.qty > 0 ? package.price / package.qty : 0 %}
<div class="wc-tpp-package" data-qty="{{ package.qty|esc_attr }}" data-price="{{ package.price|esc_attr }}">
<div class="wc-tpp-package{% if restrict_to_packages %} wc-tpp-package-selectable{% endif %}" data-qty="{{ package.qty|esc_attr }}" data-price="{{ package.price|esc_attr }}">
<div class="wc-tpp-package-header">
{% if package.label is not empty %}
<h4>{{ package.label|esc_html }}</h4>

View File

@@ -12,6 +12,6 @@
{% endif %}
{% if packages is not empty and get_option('wc_tpp_enable_package_pricing') == 'yes' %}
{% include 'frontend/package-pricing-display.twig' with {'packages': packages} %}
{% include 'frontend/package-pricing-display.twig' with {'packages': packages, 'restrict_to_packages': restrict_to_packages|default(false)} %}
{% endif %}
</div>