Mr. J Dev Smart Discount Rules gives you a flexible, priority-based discount engine on top of WooCommerce. Rules are evaluated automatically at cart/checkout — no coupon code needed.
Discount Types:
Conditions (can be combined):
Rule Control:
The discount appears as a cart fee line item with the rule name as its label, keeping the cart transparent to customers.
Weekend 15% sale for all users:
₹500 spend ₹50 off for Wholesale customers:
Buy 2 T-shirts, get 1 free (cheapest):
The Buy X Get Y rule uses a group-based algorithm that always gives the cheapest qualifying items for free.
Algorithm (step by step):
All items in the cart are flattened into individual unit prices.
e.g. Cart: 2× T-shirt @ ₹200, 1× Jeans @ ₹800, 1× Cap @ ₹150
unit prices: [200, 200, 800, 150]
Prices are sorted cheapest-first:
[150, 200, 200, 800]
The number of complete qualifying groups is calculated:
group size = Buy + Get = 3 + 1 = 4
total items = 4 floor(4 ÷ 4) = 1 group qualifies
For each group, the cheapest Get items are free:
₹150 (cap) is free discount applied = −₹150
The discount is added as a negative cart fee line item labelled with the rule name, keeping the breakdown transparent to customers.
Why cheapest-first?
This prevents customers from gaming the rule by adding one cheap item to get an expensive item free. The cheapest item always fills the free slot.
Only complete groups qualify:
With Buy 2 Get 1 and 5 items in the cart:
floor(5 ÷ 3) = 1 complete group 1 item free (the cheapest)
The leftover 2 items do not form a group and get no discount.
Configuration examples:
Combine with a Product Category condition to restrict the rule to specific product lines (e.g. only T-shirts, only Electronics).