Title: Mr. J Dev Smart Discount Rules
Author: Mr. J
Published: <strong>May 19, 2026</strong>
Last modified: May 19, 2026

---

Search plugins

![](https://ps.w.org/mr-j-dev-smart-discount-rules/assets/icon-256x256.png?rev=3537278)

# Mr. J Dev Smart Discount Rules

 By [Mr. J](https://profiles.wordpress.org/iamdeveloperajay/)

[Download](https://downloads.wordpress.org/plugin/mr-j-dev-smart-discount-rules.1.0.0.zip)

 * [Details](https://wordpress.org/plugins/mr-j-dev-smart-discount-rules/#description)
 * [Reviews](https://wordpress.org/plugins/mr-j-dev-smart-discount-rules/#reviews)
 *  [Installation](https://wordpress.org/plugins/mr-j-dev-smart-discount-rules/#installation)
 * [Development](https://wordpress.org/plugins/mr-j-dev-smart-discount-rules/#developers)

 [Support](https://wordpress.org/support/plugin/mr-j-dev-smart-discount-rules/)

## Description

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:**

 * **Percentage** — e.g. “10% off the entire cart”
 * **Fixed Amount** — e.g. “₹100 off cart”
 * **Buy X Get Y** — e.g. “Buy 2, get 1 free” (cheapest eligible items are discounted)

**Conditions (can be combined):**

 * Minimum cart spend
 * User role (customer, wholesale, subscriber, etc.)
 * Product category slug present in cart
 * Day(s) of the week (time-based deals like weekend sales)

**Rule Control:**

 * Priority system — only the highest-priority matching rule fires (no stacking)
 * Enable / disable rules without deleting them
 * Delete rules permanently

The discount appears as a cart fee line item with the rule name as its label, keeping
the cart transparent to customers.

### Usage Examples

**Weekend 15% sale for all users:**

 * Type: Percentage | Value: 15
 * Conditions  Days: Saturday, Sunday

**₹500 spend  ₹50 off for Wholesale customers:**

 * Type: Fixed | Value: 50
 * Min Spend: 500 | Conditions  Role: wholesale_customer

**Buy 2 T-shirts, get 1 free (cheapest):**

 * Type: Buy X Get Y | Buy: 2 | Get: 1
 * Conditions  Category: t-shirts

### How Buy X Get Y Works

The Buy X Get Y rule uses a **group-based algorithm** that always gives the cheapest
qualifying items for free.

**Algorithm (step by step):**

 1. 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]
 2. Prices are sorted cheapest-first:
      [150, 200, 200, 800]
 3. The number of complete qualifying groups is calculated:
     group size = Buy + Get
    = 3 + 1 = 4 total items = 4  floor(4 ÷ 4) = **1 group qualifies**
 4. 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:**

 * Buy 1 Get 1 Free  Buy: 1, Get: 1
 * Buy 2 Get 1 Free  Buy: 2, Get: 1
 * Buy 3 Get 2 Free  Buy: 3, Get: 2
 * Buy 4 Get 1 Free (BOGO4) Buy: 4, Get: 1

Combine with a **Product Category** condition to restrict the rule to specific product
lines (e.g. only T-shirts, only Electronics).

## Installation

 1. Upload the `mr-j-dev-smart-discount-rules` folder to `/wp-content/plugins/`.
 2. Activate the plugin through the **Plugins** menu in WordPress.
 3. Go to **WooCommerce  Discount Rules** to create rules.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“Mr. J Dev Smart Discount Rules” is open source software. The following people have
contributed to this plugin.

Contributors

 *   [ Mr. J ](https://profiles.wordpress.org/iamdeveloperajay/)
 *   [ ajay2188 ](https://profiles.wordpress.org/ajay2188/)

[Translate “Mr. J Dev Smart Discount Rules” into your language.](https://translate.wordpress.org/projects/wp-plugins/mr-j-dev-smart-discount-rules)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/mr-j-dev-smart-discount-rules/),
check out the [SVN repository](https://plugins.svn.wordpress.org/mr-j-dev-smart-discount-rules/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/mr-j-dev-smart-discount-rules/)
by [RSS](https://plugins.trac.wordpress.org/log/mr-j-dev-smart-discount-rules/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.0.0

 * Initial release.

## Meta

 *  Version **1.0.0**
 *  Last updated **3 days ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 5.8 or higher **
 *  Tested up to **6.9.4**
 *  PHP version ** 7.4 or higher **
 * Tags
 * [auto apply](https://wordpress.org/plugins/tags/auto-apply/)[buy x get y](https://wordpress.org/plugins/tags/buy-x-get-y/)
   [discount](https://wordpress.org/plugins/tags/discount/)[pricing rules](https://wordpress.org/plugins/tags/pricing-rules/)
   [woocommerce](https://wordpress.org/plugins/tags/woocommerce/)
 *  [Advanced View](https://wordpress.org/plugins/mr-j-dev-smart-discount-rules/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/mr-j-dev-smart-discount-rules/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/mr-j-dev-smart-discount-rules/reviews/)

## Contributors

 *   [ Mr. J ](https://profiles.wordpress.org/iamdeveloperajay/)
 *   [ ajay2188 ](https://profiles.wordpress.org/ajay2188/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/mr-j-dev-smart-discount-rules/)