Next Order Plus
Enhanced WooCommerce promotion system with advanced upselling rules. Configure customizable conditions and discounts based on cart contents.
by Omar Hosam · github.com/omarhosamcodes/next-order-plus-upselling-wp-plugin
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/omarhosamcodes/next-order-plus-upselling-wp-plugin/archive/refs/heads/main.zipA highly optimized WooCommerce plugin that automatically applies a "Next Order Plus Upselling Features" promotional discount.
Features
- Automatic Discount Application: When a customer adds 4 or more items to their cart, the cheapest item becomes free.
- Multiple Discounts: For every 4 items, an additional free item is applied (e.g., 8 items = 2 free items).
- Full Compatibility: Works with both Classic and Block Cart/Checkout experiences.
- Mini-Cart Support: Displays the discount in the mini cart dropdown.
- Shipping Rule Integration: Optionally disables free shipping when discount is applied.
- Coupon Restrictions: Prevents specific coupons from being used together with this promotion.
- Admin Settings: Fully customizable through dedicated admin interface.
- Order Statistics: Track the total number and amount of discounts applied.
Technical Architecture
Core Components
-
Base Class System:
- Abstract foundation class for all services
- Type declarations and error handling
-
Service Modules:
NOP_Discount_Service: Core discount calculation logicNOP_Cart_Service: Cart interaction and discount applicationNOP_Assets_Service: JS/CSS resource managementNOP_Coupon_Service: Coupon validation and error handlingNOP_Admin_Service: Admin interface and settings management
-
Utility Classes:
NOP_Logger: Debug logging capabilities
Design Principles
- Modular Architecture: Each service has a single responsibility
- Performance Optimized: Debounced AJAX requests prevent API spam
- Maintainable Code: Well-documented with full PHPDoc support
- Extensible Design: Filterable settings and hooks for customization
- Robust Error Handling: Graceful degradation on errors
Installation
- Upload the
next-order-plusfolder to the/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Ensure WooCommerce is installed and activated
- Configure settings via WooCommerce > Next Order Plus or SOM Plugins > Next Order Plus
Admin Settings
The plugin offers a comprehensive settings page with the following options:
- Discount Label: Customize the text displayed in the cart/checkout
- Minimum Items: Set the threshold for when the discount applies (default: 4)
- Excluded Coupons: Specify coupon codes that cannot be used with this promotion
- Disable Free Shipping: Option to disable free shipping when discount is applied
- Debug Mode: Enable/disable detailed logging for troubleshooting
Customization
The plugin provides several filters for programmatic customization:
nop_excluded_coupons: Modify the list of disallowed couponsnop_load_assets_globally: Control whether assets are loaded on all pagesnop_discount_label: Customize the discount label textnop_min_items_for_discount: Override the minimum items required for discount
Compatibility
- WordPress 5.6+
- WooCommerce 6.0+
- PHP 7.4+
- Compatible with most WooCommerce themes and plugins
Support
For issues or feature requests, please contact the plugin author.
Credits
Originally based on the "Buy 4 Get Cheapest Free" promotion concept, rewritten and optimized for modern WordPress and WooCommerce.