#DiscountKit
A powerful WordPress plugin that provides flexible discount rules for WooCommerce stores, from simple percentage discounts to complex bulk pricing strategies.
DiscountKit enables store owners to create sophisticated discount systems without custom development. Whether you need simple percentage discounts, quantity-based bulk pricing, or complex conditional rules, this plugin provides a comprehensive solution.
- Percentage Discount - Apply percentage-based discounts (e.g., 20% off)
- Fixed Amount Discount - Subtract a fixed amount from prices
- Bulk/Tiered Pricing - Create quantity-based pricing tiers
- Cart-Level Discounts - Apply discounts to entire cart subtotal
- Product-Level Discounts - Modify individual product prices
- Product Filtering - Include or exclude specific products
- Category Filtering - Target entire product categories
- Flexible Logic - Combine multiple filters with include/exclude options
- All Products - Apply discounts store-wide
- Quantity Ranges - Define min/max quantity tiers
- Multiple Pricing Tiers - Unlimited pricing levels
- Bulk Operators:
- Product Individual: Count each product separately
- Product Cumulative: Count all matching products together
- Bulk Pricing Table - Automatic display on product pages
- Custom Labels - Add descriptive labels to quantity ranges
- Priority System - Control which rules apply first
- Date Scheduling - Set start and end dates for rules
- Usage Limits - Restrict total rule applications
- Usage Tracking - Monitor how many times rules are used
- Active/Inactive Status - Enable or disable rules without deletion
- Exclusive Rules - Prevent combining with other discounts
- Real-time Calculation - Discounts apply automatically in cart
- Cart Adjustments - Display as line items or fees
- Custom Cart Labels - Personalize discount descriptions
- Strikethrough Pricing - Show original vs. discounted prices
- Sale Badges - Automatic "Sale!" badge display
- Calculate From: Choose between regular price or sale price as base
- Apply Method:
- First matching rule
- Biggest discount
- Lowest discount
- All applicable rules (stacking)
- Coupon Behavior:
- Run both coupons and discount rules
- Disable rules when coupons applied
- Disable coupons when rules applied
- Display Options:
- Show/hide strikethrough pricing
- Show/hide bulk pricing tables
- Configure sale badge behavior
- Price Modifications - Automatic price updates on product pages
- Sale Badge Control - Conditional badge display
- Discount Bar - Optional promotional message
- Bulk Pricing Table - Visual quantity discount display
- REST API - Programmatic access to discount rules
- Database Tables - Efficient custom table structure
- Caching - Performance-optimized with WordPress caching
- WooCommerce Integration - Native hooks and filters
- Internationalization Ready - Translation support included
- WordPress: 5.0 or higher
- WooCommerce: 5.0 or higher (required)
- PHP: 7.4 or higher
- Tested up to: WordPress 6.8, WooCommerce 8.5
- Download the plugin ZIP file
- Navigate to Plugins > Add New in WordPress admin
- Click Upload Plugin and select the ZIP file
- Click Install Now and then Activate
- Ensure WooCommerce is installed and activated
- Upload the
discountkitfolder to/wp-content/plugins/ - Activate the plugin through the Plugins menu in WordPress
- Navigate to WooCommerce >DiscountKit to configure
composer require nazmunsakib/discountkit- Go to WooCommerce >DiscountKit
- Click Add New Rule
- Configure the rule:
- Title: Give your rule a descriptive name
- Discount Type: Choose percentage, fixed, or bulk
- Discount Value: Enter the discount amount
- Filters: Select which products to target
- Priority: Set rule order (lower numbers = higher priority)
- Click Save Rule
Title: Summer Sale
Discount Type: Percentage
Discount Value: 20
Apply To: All Products
Status: Active
Title: Electronics 15% Off
Discount Type: Percentage
Discount Value: 15
Apply To: Specific Categories
Selected Categories: Electronics
Status: Active
Title: Bulk T-Shirt Discount
Discount Type: Bulk
Apply To: Specific Products
Bulk Ranges:
- 1-5 items: 0% off
- 6-10 items: 10% off
- 11-20 items: 15% off
- 21+ items: 20% off
Bulk Operator: Product Cumulative
Status: Active
Title: Spend & Save
Discount Type: Fixed
Discount Value: 10
Apply As: Cart Rule
Minimum Subtotal: 100
Cart Label: "You saved $10!"
Status: Active
Title: Holiday Special
Discount Type: Percentage
Discount Value: 25
Apply To: All Products
Date From: 2024-12-01
Date To: 2024-12-31
Status: Active
Title: Flash Sale - First 100 Orders
Discount Type: Percentage
Discount Value: 30
Apply To: All Products
Usage Limit: 100
Status: Active
- Clearance Sales - Discount specific products or categories
- Seasonal Promotions - Time-limited discounts
- New Customer Offers - First-time purchase incentives
- Loyalty Rewards - Repeat customer discounts
- Tiered Pricing - Volume-based discounts
- Bulk Orders - Quantity-based pricing
- Trade Discounts - Category-specific wholesale pricing
- Flash Sales - Limited-time, high-discount promotions
- Bundle Deals - Multi-product discounts
- Cart Incentives - Minimum purchase rewards
- Abandoned Cart Recovery - Special discount codes
Access settings via WooCommerce >DiscountKit > Settings
- Regular Price: Base discounts on original product prices
- Sale Price: Apply discounts to already-reduced sale prices
- First: Apply only the first matching rule
- Biggest Discount: Apply the rule with the largest discount
- Lowest Discount: Apply the rule with the smallest discount
- All: Stack all applicable discounts (use with caution)
- Run Both: Allow coupons and discount rules simultaneously
- Disable Rules: Turn off discount rules when coupons are applied
- Disable Coupons: Prevent coupon usage when discount rules apply
- Show Strikeout: Display original price with strikethrough
- Show Bulk Table: Display bulk pricing table on product pages
- Sale Badge: Control when "Sale!" badges appear
// Modify discount calculation
add_filter('discountkit_calculate_discount', function($discount, $rule, $product) {
// Custom logic
return $discount;
}, 10, 3);
// Modify product discount price
add_filter('discountkit_product_discount_price', function($price, $product_id) {
// Custom logic
return $price;
}, 10, 2);// After rule is applied
add_action('discountkit_rule_applied', function($rule_id, $product_id) {
// Custom logic
}, 10, 2);
// After discount calculation
add_action('discountkit_discount_calculated', function($discount_amount, $cart) {
// Custom logic
}, 10, 2);Access discount rules programmatically:
GET /wp-json/discountkit/v1/rules
GET /wp-json/discountkit/v1/rules/{id}
POST /wp-json/discountkit/v1/rules
PUT /wp-json/discountkit/v1/rules/{id}
DELETE /wp-json/discountkit/v1/rules/{id}
The plugin creates two custom tables:
wp_discountkit_rules- Stores discount ruleswp_discountkit_settings- Stores plugin settings
- Check rule status is Active
- Verify product matches rule filters
- Check date range if configured
- Verify usage limit not reached
- Check rule priority order
- Check Coupon Behavior setting
- Disable third-party discount plugins temporarily
- Clear WooCommerce cache
- Check for theme conflicts
- Limit number of active rules
- Use specific product/category filters instead of "All Products"
- Enable WordPress object caching
- Optimize database tables
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Clone repository
git clone https://github.com/nazmunsakib/discountkit.git
# Install dependencies
composer install
# Run tests
composer test- Initial release
- Percentage discount support
- Fixed discount support
- Bulk discount support
- Product and category filtering
- Include/exclude logic
- Priority-based rule ordering
- Cart adjustment rules
- Settings management
- Usage tracking
- REST API endpoints
- Bulk pricing table display
- Sale badge control
- Strikethrough pricing
This plugin is licensed under the GPL v2 or later.
DiscountKit
Copyright (C) 2024 Nazmun Sakib
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Nazmun Sakib
- Website: nazmunsakib.com
- GitHub: @nazmunsakib
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
If you find this plugin helpful, please consider:
- Giving it a β on GitHub
- Sharing it with others
- Contributing to development
- Reporting bugs and suggesting features
Made with β€οΈ for the WooCommerce community