Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/emarketingcy/wc-quantity-control/archive/refs/heads/main.zipWooCommerce Quantity Control Plugin
A modern WooCommerce plugin that allows administrators to set minimum and maximum order quantities globally or per product, with real-time frontend validation and a beautiful admin interface.
Features
🎯 Core Functionality
- Global Quantity Limits: Set minimum and maximum quantities that apply to all products
- Product-Specific Overrides: Override global settings for individual products
- Real-Time Validation: Prevent users from entering invalid quantities with instant feedback
- Cart Validation: Validate quantities when items are added to cart or cart is updated
- Checkout Protection: Ensure invalid quantities cannot proceed to checkout
🎨 Modern Admin Interface
- Responsive Design: Works perfectly on desktop, tablet, and mobile devices
- Apple-Level Design: Clean, modern interface with smooth animations and micro-interactions
- AJAX-Powered: Save settings without page reloads
- Visual Feedback: Loading states, success animations, and error handling
- Accessibility: Full keyboard navigation and screen reader support
🚀 User Experience
- Auto-Correction: Automatically adjusts invalid quantities to nearest valid value
- Visual Indicators: Clear error messages and validation states
- Customizable Messages: Configure quantity limit messages shown to customers
- Mobile-Friendly: Optimized for mobile shopping experience
Installation
- Upload the
wc-quantity-controlfolder to your/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Navigate to WooCommerce → Quantity Control to configure settings
Configuration
Global Settings
- Go to WooCommerce → Quantity Control
- Configure global minimum and maximum quantities
- Enable/disable quantity limit messages
- Customize the message text (use
{min}and{max}as placeholders)
Product-Specific Settings
- Edit any product in Products → All Products
- Go to the Inventory tab
- Check "Override Global Limits"
- Set custom minimum and maximum quantities for that product
Technical Specifications
Requirements
- WordPress 5.0+
- WooCommerce 5.0+
- PHP 7.4+
File Structure
wc-quantity-control/
├── wc-quantity-control.php # Main plugin file
├── includes/
│ ├── class-admin.php # Admin functionality
│ ├── class-frontend.php # Frontend functionality
│ └── class-validator.php # Validation logic
├── assets/
│ ├── css/
│ │ └── admin-style.css # Admin interface styles
│ └── js/
│ ├── admin-script.js # Admin JavaScript
│ └── frontend-script.js # Frontend validation
├── templates/
│ └── admin-page.php # Admin page template
└── README.md # Documentation
Database Schema
Options Table (wp_options)
wc_qc_global_min_quantity: Global minimum quantity (default: 1)wc_qc_global_max_quantity: Global maximum quantity (default: 999)wc_qc_enable_global_limits: Enable/disable global limits (yes/no)wc_qc_show_quantity_message: Show quantity messages (yes/no)wc_qc_quantity_message: Custom message template
Post Meta (wp_postmeta)
_wc_qc_override_global: Override global settings (yes/no)_wc_qc_min_quantity: Product-specific minimum quantity_wc_qc_max_quantity: Product-specific maximum quantity
Hooks and Filters
Actions
woocommerce_add_to_cart_validation: Validates quantities when adding to cartwoocommerce_check_cart_items: Validates cart itemswoocommerce_update_cart_validation: Validates cart updates
Filters
woocommerce_quantity_input_args: Modifies quantity input arguments
Customization
Custom CSS
Add custom styles to your theme's CSS:
/* Customize quantity message appearance */
.wc-qc-quantity-message {
background: #your-color;
border-color: #your-border-color;
}
/* Customize validation error styles */
.wc-qc-invalid {
border-color: #your-error-color !important;
}
Custom JavaScript
Extend functionality with custom JavaScript:
// Custom validation logic
$(document).on('wc_qc_quantity_validated', function(e, input, isValid) {
// Your custom logic here
});
Troubleshooting
Common Issues
Q: Quantity limits are not working A: Ensure WooCommerce is active and the plugin is properly activated. Check that global limits are enabled in settings.
Q: Product-specific limits not overriding global settings A: Make sure "Override Global Limits" is checked in the product's Inventory tab.
Q: Frontend validation not working A: Check browser console for JavaScript errors. Ensure jQuery is loaded properly.
Debug Mode
Add this to your wp-config.php for debugging:
define('WC_QC_DEBUG', true);
Support
For support, feature requests, or bug reports:
- Check the documentation above
- Search existing issues
- Create a new support ticket with detailed information
Changelog
Version 1.0.0
- Initial release
- Global quantity limits
- Product-specific overrides
- Modern admin interface
- Real-time frontend validation
- Mobile-responsive design
License
This plugin is licensed under the GPL v2 or later.
Credits
Developed with ❤️ for the WooCommerce community.