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/milosmilenkovic007/softuni-cheapest-unit-off/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
SoftUni - Cheapest Unit Off (WooCommerce Plugin)
A WooCommerce plugin that applies the price of the cheapest single unit in the cart as a discount when specific conditions are met.
Description
This plugin adds a new coupon functionality to WooCommerce that automatically applies the price of the cheapest single unit in the cart as a discount when:
- A coupon with this feature enabled is active
- The cart contains a minimum number of items (default: 3)
- The coupon is of type "Fixed cart"
Features
- Applies the price of the cheapest single unit as a cart discount
- Configurable minimum quantity requirement (default: 3 items)
- Works with WooCommerce's "Fixed cart" coupon type
- Preserves original product prices (discount is applied at cart level)
- Handles tax calculations correctly (works with prices including/excluding tax)
- Compatible with other WooCommerce discounts and coupons
Installation
- Upload the plugin files to
/wp-content/plugins/softuni-cheapest-freedirectory - Activate the plugin through the 'Plugins' menu in WordPress
- Make sure WooCommerce is installed and activated
Usage
- Go to WooCommerce → Coupons
- Create a new coupon or edit an existing one
- Set the coupon type to "Fixed cart"
- In the coupon settings, enable "SoftUni: Cheapest Unit as Discount"
- (Optional) Adjust the minimum quantity requirement (default is 3 items)
- Save the coupon
When applied to a cart with sufficient items, the coupon will automatically set its discount amount to match the price of the cheapest single unit in the cart.
Requirements
- WordPress 6.0 or higher
- PHP 7.4 or higher
- WooCommerce (latest version recommended)
Technical Details
The plugin:
- Uses WooCommerce hooks for cart calculations
- Properly handles tax calculations (works with prices excluding tax)
- Maintains cart item prices and applies discount at cart level
- Validates coupon type and minimum quantity requirements
- Provides clear error messages when requirements are not met
License
GPLv2 or later