From af532b56eba9b9f87dc2bc89b05403733627586e Mon Sep 17 00:00:00 2001 From: magdev Date: Mon, 22 Dec 2025 00:15:48 +0100 Subject: [PATCH] Release version 1.1.7 - Enhanced user experience features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added three new customer-facing features to improve product page interaction and tier pricing functionality. Features: - Optional text labels for tier pricing (similar to package labels) - Clickable tier pricing table rows to auto-populate quantity field - Add to Cart button auto-disables when quantity is 0 or less Enhanced User Experience: - Tier pricing rows now clickable with cursor pointer and hover animation - Clicking tier row sets quantity and smoothly scrolls to quantity field - Add to Cart button shows disabled state with reduced opacity - Tier labels display below quantity in italic gray text Technical Changes: - Added optional 'label' field to tier pricing admin meta box - Updated tier save logic to include label field (sanitized) - Enhanced tier pricing frontend template to display labels - Added click handler for tier pricing rows in frontend.js - Added updateAddToCartButton() function to manage button state - CSS: .wc-tpp-tier-label styling for tier labels - CSS: Clickable cursor and hover transform for tier rows - CSS: Disabled button styling (.single_add_to_cart_button:disabled) Updated Files: - templates/admin/tier-row.twig (added label field) - includes/class-wc-tpp-product-meta.php (save label, template update) - templates/frontend/tier-pricing-table.twig (display labels) - assets/js/frontend.js (tier row clicks, button disable logic) - assets/css/frontend.css (tier label style, clickable rows, disabled button) - wc-tier-and-package-prices.php (version 1.1.7) - composer.json (version 1.1.7) - CHANGELOG.md (v1.1.7 section) šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .claude/settings.local.json | 3 +- CHANGELOG.md | 27 ++ assets/css/frontend.css | 20 +- assets/js/frontend.js | 32 ++ composer.json | 2 +- includes/class-wc-tpp-product-meta.php | 5 +- releases/RELEASE-INFO-1.1.6.md | 352 ++++++++++++++++++ releases/wc-tier-and-package-prices-1.1.6.zip | Bin 0 -> 55032 bytes .../wc-tier-and-package-prices-1.1.6.zip.md5 | 1 + ...c-tier-and-package-prices-1.1.6.zip.sha256 | 1 + templates/admin/tier-row.twig | 8 + templates/frontend/tier-pricing-table.twig | 7 +- wc-tier-and-package-prices.php | 4 +- 13 files changed, 454 insertions(+), 8 deletions(-) create mode 100644 releases/RELEASE-INFO-1.1.6.md create mode 100644 releases/wc-tier-and-package-prices-1.1.6.zip create mode 100644 releases/wc-tier-and-package-prices-1.1.6.zip.md5 create mode 100644 releases/wc-tier-and-package-prices-1.1.6.zip.sha256 diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 37f52d9..103486f 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -19,7 +19,8 @@ "Bash(do msgfmt -o \"$po%.po.mo\" \"$po\")", "Bash(done)", "Bash(git commit -m \"$\\(cat <<''EOF''\nRelease version 1.1.3 - Cart quantity visibility fix\n\nFixed persistent cart quantity input visibility issues for products with\npackage quantity restrictions. Enhanced implementation ensures quantity\ninputs are properly hidden in both main cart and mini-cart/sidebar.\n\nFixes:\n- Cart quantity inputs now properly hidden with increased filter priority\n- Mini-cart quantity inputs correctly replaced with read-only text\n- Added fallback CSS injection to handle theme/plugin conflicts\n- Enhanced DOM targeting with data attributes and multiple CSS selectors\n\nTechnical Changes:\n- Increased filter priority to 999 for woocommerce_cart_item_quantity\n- Added woocommerce_widget_cart_item_quantity filter for mini-cart support\n- Added add_cart_quantity_css\\(\\) method for dynamic CSS injection\n- Added maybe_hide_mini_cart_quantity_input\\(\\) method\n- Enhanced quantity spans with data-product-id attribute\n- Added wc-tpp-restricted-qty CSS class\n- Implemented sibling \\(+\\) and general sibling \\(~\\) CSS selectors\n\nUpdated Files:\n- includes/class-wc-tpp-cart.php \\(enhanced with mini-cart support\\)\n- wc-tier-and-package-prices.php \\(version 1.1.3\\)\n- composer.json \\(version 1.1.3\\)\n- CHANGELOG.md \\(v1.1.3 section\\)\n- All translation files \\(.pot, .po, .mo\\) updated to version 1.1.3\n\nšŸ¤– Generated with [Claude Code]\\(https://claude.com/claude-code\\)\n\nCo-Authored-By: Claude Sonnet 4.5 \nEOF\n\\)\")", - "Bash(git commit:*)" + "Bash(git commit:*)", + "Bash(node -c:*)" ] } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 336444b..9d54627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,33 @@ 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.1.7] - 2025-12-22 + +### Added + +- Optional text labels for tier pricing (similar to package labels) +- Clickable tier pricing rows that auto-populate quantity field +- Add to Cart button auto-disable when quantity is 0 or less + +### Enhanced + +- Tier pricing table rows now clickable with visual hover feedback +- Clicking a tier row sets quantity to that tier's minimum quantity +- Smooth scroll animation to quantity field when tier is clicked +- Add to Cart button disabled state with visual feedback (opacity, cursor) +- Tier labels display below quantity in frontend table (italic, gray text) + +### Technical Details + +- Added optional `label` field to tier pricing meta box (admin/tier-row.twig) +- Updated tier save logic to store label field (class-wc-tpp-product-meta.php) +- Enhanced tier pricing template to display labels (frontend/tier-pricing-table.twig) +- Added click handler for tier rows (assets/js/frontend.js) +- Added `updateAddToCartButton()` function to manage button state +- CSS: `.wc-tpp-tier-label` styling for tier labels +- CSS: Clickable cursor and hover animation for tier rows +- CSS: Disabled button styling (`.single_add_to_cart_button:disabled`) + ## [1.1.6] - 2025-12-21 ### Fixed diff --git a/assets/css/frontend.css b/assets/css/frontend.css index 8587905..8cc319f 100644 --- a/assets/css/frontend.css +++ b/assets/css/frontend.css @@ -50,11 +50,13 @@ .wc-tpp-table tbody tr { border-bottom: 1px solid #e0e0e0; - transition: background-color 0.2s; + transition: all 0.2s; + cursor: pointer; } .wc-tpp-table tbody tr:hover { background: #f5f5f5; + transform: translateX(2px); } .wc-tpp-table tbody tr.wc-tpp-active-tier { @@ -67,6 +69,14 @@ font-size: 0.95em; } +.wc-tpp-tier-label { + display: inline-block; + margin-top: 4px; + color: #666; + font-style: italic; + font-size: 0.9em; +} + /* Package pricing */ .wc-tpp-packages { display: grid; @@ -209,6 +219,14 @@ a.wc-tpp-view-options:hover { font-size: 0.95em; } +/* Disabled add to cart button */ +.single_add_to_cart_button.disabled, +.single_add_to_cart_button:disabled { + opacity: 0.5; + cursor: not-allowed; + pointer-events: none; +} + /* Responsive design */ @media (max-width: 768px) { .wc-tpp-packages { diff --git a/assets/js/frontend.js b/assets/js/frontend.js index 4da8b16..8e36491 100644 --- a/assets/js/frontend.js +++ b/assets/js/frontend.js @@ -8,6 +8,7 @@ $(document).ready(function() { const $quantityInput = $('input.qty'); const $priceDisplay = $('.woocommerce-Price-amount.amount').first(); + const $addToCartButton = $('.single_add_to_cart_button'); const isRestrictedMode = $('.wc-tpp-package-pricing-table').hasClass('wc-tpp-restricted-mode'); if ($quantityInput.length === 0 && !isRestrictedMode) { @@ -154,9 +155,35 @@ $('.wc-tpp-price-message').remove(); } + // Toggle add to cart button state based on quantity + function updateAddToCartButton() { + const quantity = parseInt($quantityInput.val()) || 0; + + if (quantity <= 0) { + $addToCartButton.prop('disabled', true).addClass('disabled'); + } else { + $addToCartButton.prop('disabled', false).removeClass('disabled'); + } + } + // Handle quantity input changes $quantityInput.on('input change', function() { updatePriceDisplay(); + updateAddToCartButton(); + }); + + // Handle tier pricing row clicks + $('.wc-tpp-tier-pricing-table tbody tr').on('click', function() { + const minQty = parseInt($(this).data('min-qty')); + + if ($quantityInput.length > 0 && !isRestrictedMode) { + $quantityInput.val(minQty).trigger('change'); + + // Scroll to quantity input for better UX + $('html, body').animate({ + scrollTop: $quantityInput.offset().top - 100 + }, 300); + } }); // Handle package selection @@ -212,6 +239,11 @@ if (!isRestrictedMode) { updatePriceDisplay(); } + + // Initial button state check + if ($quantityInput.length > 0 && $addToCartButton.length > 0) { + updateAddToCartButton(); + } }); })(jQuery); diff --git a/composer.json b/composer.json index 2161249..2eec1a1 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "magdev/wc-tier-package-prices", "description": "WooCommerce plugin for tier pricing and package prices with Twig templates", - "version": "1.1.6", + "version": "1.1.7", "type": "wordpress-plugin", "license": "GPL-2.0-or-later", "authors": [ diff --git a/includes/class-wc-tpp-product-meta.php b/includes/class-wc-tpp-product-meta.php index 57a86b2..2a6424a 100644 --- a/includes/class-wc-tpp-product-meta.php +++ b/includes/class-wc-tpp-product-meta.php @@ -81,7 +81,7 @@ class WC_TPP_Product_Meta {