Commit Graph

6 Commits

Author SHA1 Message Date
fa7ec0e422 Fix two critical bugs in v1.1.9
Bug 1: Admin - Both General and Composable tabs visible on initial load
- Added explicit display:none to #composable_product_data panel
- Panel now hidden by default, shows only when product-type-composable class is present
- Prevents both tabs showing simultaneously on new product creation

Bug 2: Frontend - No feedback when no products configured
- Added empty state message when products array is empty
- Users now see helpful message instead of blank grid
- Cleared Twig cache to ensure template changes take effect

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 22:34:46 +01:00
4dc7b767a8 Fix admin CSS - tabs disappeared due to overly aggressive selectors
CRITICAL FIX: The previous CSS change used .show_if_composable with !important
which hid ALL elements with that class, including the tab links themselves.

Changes:
- Changed from .show_if_composable to .options_group.show_if_composable
- Changed from .product_data_tabs .composable_options to li.composable_options
- Removed !important flags (not needed with specific selectors)
- Now only hides the general tab option groups, not the tab links

This fixes:
- Missing Composable Options tab in product edit screen
- Fields appearing out of context
- Tab navigation completely broken

The issue was that WooCommerce adds 'show_if_composable' class to BOTH:
1. The tab link (li.composable_options.show_if_composable)
2. The general tab fields (div.options_group.show_if_composable)

Now we specifically target only the option groups, leaving tabs alone.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 22:16:37 +01:00
c6a48d6404 Fix critical UI bugs in admin and frontend
Fixes three critical bugs reported in CLAUDE.md:

1. Admin rendering bug - Fixed CSS to prevent both General and Composable
   Options tabs from showing simultaneously on initial page load
   - Enhanced CSS specificity with !important flags
   - Added body.product-type-composable selectors for proper visibility control
   - Hides Composable Options tab by default, shows only when composable type selected

2. Frontend product selector not appearing - Fixed WooCommerce integration
   - Added hide_default_add_to_cart() method to Cart_Handler
   - Hooks woocommerce_is_purchasable filter to return false for composable products
   - This hides WooCommerce's default add-to-cart button
   - Allows our custom product selector to be the only interface

3. Localized price formatting - Implemented proper WooCommerce price formatting
   - Added wc_price Twig function in Plugin.php
   - Updated Product_Selector to pass formatted price HTML to template
   - Added price_format data to JavaScript localization
   - Implemented formatPrice() method in frontend.js
   - Supports all WooCommerce price formats (currency position, decimals, separators)
   - Template now uses {{ fixed_price_html|raw }} and {{ zero_price_html|raw }}
   - JavaScript dynamically formats prices using locale-specific settings

Technical improvements:
- Cart_Handler.php: +14 lines (hide_default_add_to_cart method)
- Plugin.php: +7 lines (wc_price function, price format localization)
- Product_Selector.php: +2 lines (formatted price HTML context)
- templates/product-selector.twig: Modified to use formatted price HTML
- assets/css/admin.css: +24 lines (enhanced tab visibility control)
- assets/js/frontend.js: +28 lines (formatPrice method with WooCommerce format support)

All PHP files pass lint checks. Frontend now properly displays localized prices
with correct currency symbols, decimal separators, and thousand separators for
all WooCommerce-supported locales (CHF for Switzerland, € for Europe, etc.).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 22:08:08 +01:00
867abc8f63 Document v1.1.4 session: Fixed price field enhancement
Added session history for v1.1.4 which introduced:
- Fixed price field in Composable Options tab
- JavaScript toggle based on pricing mode selection
- Improved admin UX with progressive disclosure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 21:01:52 +01:00
e9df6e4278 Implement comprehensive stock management integration (v1.1.0)
Added complete inventory tracking system for composable products:
- Stock validation during product selection and add-to-cart
- Automatic stock deduction on order completion/processing
- Automatic stock restoration on order cancellation/refund
- Stock status indicators with visual feedback (In stock, Low stock, Out of stock)
- Prevention of out-of-stock item selection
- Low stock warnings when 5 or fewer items remain
- Order notes documenting all stock changes

New files:
- includes/Stock_Manager.php: Core stock management logic

Modified files:
- includes/Cart_Handler.php: Integrated stock validation
- includes/Product_Selector.php: Added stock info to product data
- includes/Plugin.php: Added Stock_Manager to includes
- templates/product-selector.twig: Stock status display
- assets/css/frontend.css: Stock indicator styling
- languages/*.pot/*.po: 8 new translatable strings

Version bumped to 1.1.0 with updated CHANGELOG.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 16:41:53 +01:00
1edb0be3d9 Initial implementation of WooCommerce Composable Products plugin
Implemented custom WooCommerce product type allowing customers to build their own
product bundles by selecting from predefined sets of products.

Features:
- Custom "Composable Product" type with admin interface
- Product selection by category, tag, or SKU
- Configurable selection limits (global and per-product)
- Dual pricing modes: fixed price or sum of selected products
- Modern responsive frontend with Twig templates
- AJAX add-to-cart functionality
- Full internationalization support (.pot file)
- WooCommerce settings integration
- Comprehensive documentation

Technical implementation:
- PHP 8.3+ with PSR-4 autoloading
- Twig 3.0 templating engine via Composer
- Vanilla JavaScript with jQuery for frontend interactions
- WordPress and WooCommerce hooks for seamless integration
- Security: input sanitization, validation, and output escaping
- Translation-ready with text domain 'wc-composable-product'

Documentation:
- README.md: Project overview and features
- INSTALL.md: Installation and usage guide
- IMPLEMENTATION.md: Technical architecture
- CHANGELOG.md: Version history

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 00:38:29 +01:00