=== Product Bundle Quantity ===
Contributors: kundankb
Tags: bundles, quantity, discounts, product bundles, customizable
Requires at least: 5.9
Tested up to: 6.9
Stable tag: 2.5.0
Requires PHP: 7.4
WC requires at least: 5.0
WC tested up to: 8.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Create custom product bundles with specific quantities and discounts for WooCommerce. Fully customizable with color options and flexible display controls.

== Description ==

Product Bundle Quantity enhances your product pages by offering customers predefined bundles with special pricing. With this plugin, you can:

* Create multiple product bundles, each with its own image and discount.
* Display bundle options on the product's single page.
* Automatically apply the selected bundle's image, quantity, and discount to the cart.

= Features =

**Bundle Management**

* Easy-to-use admin interface for creating and managing product bundles
* Supports multiple bundles per product, each with unique images and discounts
* Seamless integration with WooCommerce's product gallery and cart system
* Shortcode support: [product_bundle_quantities] for flexible placement (backward compatible with [product_bundle_options] and [kund_bundle_options])

**Color Customization**

* 9 Customizable Colors - Complete control over all frontend visual elements
* Automatic Theme Detection - Auto-detect and apply your WordPress theme's color palette
* Per-Product Overrides - Set custom colors for individual products
* WCAG 2.1 AA Compliant - Built-in contrast ratio validation for accessibility
* Live Preview - See color changes in real-time with WordPress color picker

**Display Controls**

* Toggle Stock Label - Show/hide the "In Stock" indicator
* Toggle Security Message - Control visibility of the security assurance message
* Flexible Configuration - Global settings with per-product customization

**Performance & Compatibility**

* Modern CSS custom properties for efficient styling
* Minimal performance impact with optimized code
* Compatible with all modern WordPress and WooCommerce versions
* Works seamlessly with block themes and classic themes

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/product-bundle-quantity` directory, or install the plugin directly through the WordPress plugins screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Navigate to the product edit screen where you want to add bundles.
4. Use the new **Bundle Quantity Options** section to add and configure your bundles.

== Frequently Asked Questions ==

= Can I create multiple bundles for a single product? =

Yes, you can create as many bundles as needed, each with its own image and discount.

= How do I remove or edit a bundle? =

In the product edit screen, simply delete or modify the bundle in the Bundle Quantity Options section.

= How does theme color detection work? =

The plugin automatically detects colors from your active theme's theme.json (for block themes) or theme customizer settings (for classic themes). Simply click "Auto-Detect Theme Colors" in the settings.

= Can I use different colors for different products? =

Yes! Set global colors in WooCommerce > Bundle Settings, then enable "Use Custom Colors" on individual products to override the global settings.

= Does this plugin affect my site's performance? =

No. The plugin uses modern CSS custom properties for efficient styling with minimal overhead. All colors are generated once and cached by WordPress.

= Is the plugin accessible? =

Yes! The plugin includes built-in WCAG 2.1 AA contrast ratio validation and will warn you if color combinations don't meet accessibility standards.

= Can I hide the stock label or security message? =

Yes, you can control the visibility of both elements in WooCommerce > Bundle Settings > Display Options.

= How do I use the shortcode? =

You can display bundle options anywhere using the shortcode [product_bundle_quantities]. The plugin also supports legacy shortcodes [product_bundle_options] and [kund_bundle_options] for backward compatibility. Simply add the shortcode to any page, post, or widget where you want to display the bundle options.

= Will my old shortcodes still work after the update? =

Yes! All previous shortcode versions ([product_bundle_options] and [kund_bundle_options]) continue to work perfectly. We maintain full backward compatibility to ensure your existing content doesn't break.

== Screenshots ==

1. Admin Interface - Easily create and manage product bundles
2. Frontend Display - Customers can choose from multiple bundles on the product page
3. Color Customization Settings - Full control over all color options
4. Display Options - Toggle visibility of stock label and security message

== Changelog ==

= 2.5.0 - 2025-12-30 =

**New Features**

* Automatic Bundle Image Gallery Sync
  - Bundle images are now automatically added to WooCommerce product gallery
  - Dual-hook system ensures images persist correctly
  - Smart duplicate prevention
  - Admin confirmation notice after successful sync
  - Full validation and error handling

* Updated Primary Shortcode
  - New primary shortcode: [product_bundle_quantities]
  - Backward compatibility maintained for [product_bundle_options] and [kund_bundle_options]
  - Improved documentation with usage examples

* Premium License System
  - Integrated license activation and validation
  - Premium features: Custom colors and product discounts
  - Automatic license verification
  - User-friendly license management interface

**Improvements**

* Enhanced product gallery integration with WooCommerce CRUD methods
* Improved hook priority to prevent conflicts with WooCommerce save process
* Better image validation (checks MIME types and attachment validity)
* Cleaner codebase with optimized performance
* Added extensibility hooks for developers (kbq_before_add_bundle_images_to_gallery, kbq_bundle_image_ids, kbq_after_add_bundle_images_to_gallery)

**Bug Fixes**

* Fixed bundle images not persisting in product gallery
* Fixed timing issues with WooCommerce product save process
* Improved compatibility with HPOS (High-Performance Order Storage)

= 2.4.0 - 2025-12-22 =

**Major Features**

* Complete Color Customization System
  - Added 9 customizable color options for all frontend elements
  - Implemented WordPress Iris color picker integration
  - Created dedicated settings page under WooCommerce menu with tabbed interface

* Automatic Theme Color Detection
  - Auto-detect colors from theme.json (Block themes)
  - Auto-detect colors from theme customizer (Classic themes)
  - Smart color mapping with intelligent fallbacks
  - One-click "Auto-Detect Theme Colors" button

* Per-Product Color Overrides
  - Allow custom colors for individual products
  - Seamless fallback to global settings
  - Easy toggle to enable/disable per-product customization

* Display Toggle Controls
  - Toggle "In Stock" label visibility
  - Toggle security message visibility
  - Visual previews in admin settings

**Accessibility & Performance**

* WCAG 2.1 AA Compliance
  - Real-time contrast ratio validation
  - Automatic warnings for insufficient contrast
  - Minimum 4.5:1 ratio enforcement for text

* Performance Optimizations
  - CSS custom properties for efficient styling
  - Single inline style block (minimal overhead)
  - WordPress Options API caching
  - Conditional asset loading

**User Experience**

* Settings organized in intuitive tabbed interface (Colors | Display Options)
* Live color preview with WordPress color picker
* Clear descriptions and help text
* Link to global settings from product edit page

**Technical Improvements**

* Updated to WordPress 5.9+ minimum requirement
* PHP 7.4+ requirement
* WooCommerce 5.0+ compatibility
* Modern CSS custom properties with fallbacks
* Complete internationalization support
* WordPress coding standards compliant
* Security: All inputs sanitized, all outputs escaped
* Nonces and capability checks on all forms
* Fixed currency symbol inconsistency - now uses WooCommerce currency settings
* Fixed display toggle options not saving properly

**Bug Fixes**

* Fixed admin.css path typo in enqueue function
* Improved error handling for theme detection
* Enhanced color sanitization with validation
* Fixed WooCommerce HPOS compatibility warning
* Fixed currency symbol display to match WooCommerce settings
* Fixed checkbox sanitization for display toggles

= 2.2.0 =

* Initial release with full bundle creation and management features

== Upgrade Notice ==

= 2.5.0 =
Major update with automatic bundle image gallery sync, updated shortcode system, and premium license integration. Bundle images now automatically appear in product galleries! Fully backward compatible - all existing shortcodes continue to work.

= 2.4.0 =
Major update with complete color customization system, theme auto-detection, display controls, and improved accessibility. Recommended for all users.

== Support ==

For support, please visit https://kundankb.com/

== License ==

This plugin is licensed under the GPLv2 or later.
