{"id":314724,"date":"2026-05-19T12:08:21","date_gmt":"2026-05-19T12:08:21","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/mr-j-dev-smart-discount-rules\/"},"modified":"2026-05-19T12:07:49","modified_gmt":"2026-05-19T12:07:49","slug":"mr-j-dev-smart-discount-rules","status":"publish","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/mr-j-dev-smart-discount-rules\/","author":20617242,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.0","stable_tag":"1.0.0","tested":"6.9.4","requires":"5.8","requires_php":"7.4","requires_plugins":null,"header_name":"Mr. J Dev Smart Discount Rules","header_author":"Mr. J","header_description":"Create advanced auto-apply discount rules beyond default coupons \u2014 buy X get Y, spend-based percentage discounts, role\/category\/time conditions, and a priority-based rule engine.","assets_banners_color":"387d9c","last_updated":"2026-05-19 12:07:49","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/ajay2188\/mr-j-dev-smart-discount-rules","header_author_uri":"","rating":0,"author_block_rating":0,"active_installs":0,"downloads":24,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"iamdeveloperajay","date":"2026-05-19 12:07:49"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-256x256.png":{"filename":"icon-256x256.png","revision":3537278,"resolution":"256x256","location":"assets","locale":"","width":512,"height":517}},"assets_banners":{"banner-1544x500.jpg":{"filename":"banner-1544x500.jpg","revision":3537278,"resolution":"1544x500","location":"assets","locale":"","width":1544,"height":500}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[168969,241402,331,241051,286],"plugin_category":[45],"plugin_contributors":[263290,263291],"plugin_business_model":[],"class_list":["post-314724","plugin","type-plugin","status-publish","hentry","plugin_tags-auto-apply","plugin_tags-buy-x-get-y","plugin_tags-discount","plugin_tags-pricing-rules","plugin_tags-woocommerce","plugin_category-ecommerce","plugin_contributors-ajay2188","plugin_contributors-iamdeveloperajay","plugin_committers-iamdeveloperajay"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/mr-j-dev-smart-discount-rules\/assets\/icon-256x256.png?rev=3537278","icon_2x":"https:\/\/ps.w.org\/mr-j-dev-smart-discount-rules\/assets\/icon-256x256.png?rev=3537278","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>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 \u2014 no coupon code needed.<\/p>\n\n<p><strong>Discount Types:<\/strong><\/p>\n\n<ul>\n<li><strong>Percentage<\/strong> \u2014 e.g. \"10% off the entire cart\"<\/li>\n<li><strong>Fixed Amount<\/strong> \u2014 e.g. \"\u20b9100 off cart\"<\/li>\n<li><strong>Buy X Get Y<\/strong> \u2014 e.g. \"Buy 2, get 1 free\" (cheapest eligible items are discounted)<\/li>\n<\/ul>\n\n<p><strong>Conditions (can be combined):<\/strong><\/p>\n\n<ul>\n<li>Minimum cart spend<\/li>\n<li>User role (customer, wholesale, subscriber, etc.)<\/li>\n<li>Product category slug present in cart<\/li>\n<li>Day(s) of the week (time-based deals like weekend sales)<\/li>\n<\/ul>\n\n<p><strong>Rule Control:<\/strong><\/p>\n\n<ul>\n<li>Priority system \u2014 only the highest-priority matching rule fires (no stacking)<\/li>\n<li>Enable \/ disable rules without deleting them<\/li>\n<li>Delete rules permanently<\/li>\n<\/ul>\n\n<p>The discount appears as a cart fee line item with the rule name as its label, keeping the cart transparent to customers.<\/p>\n\n<h3>Usage Examples<\/h3>\n\n<p><strong>Weekend 15% sale for all users:<\/strong><\/p>\n\n<ul>\n<li>Type: Percentage | Value: 15<\/li>\n<li>Conditions \u2192 Days: Saturday, Sunday<\/li>\n<\/ul>\n\n<p><strong>\u20b9500 spend \u2192 \u20b950 off for Wholesale customers:<\/strong><\/p>\n\n<ul>\n<li>Type: Fixed | Value: 50<\/li>\n<li>Min Spend: 500 | Conditions \u2192 Role: wholesale_customer<\/li>\n<\/ul>\n\n<p><strong>Buy 2 T-shirts, get 1 free (cheapest):<\/strong><\/p>\n\n<ul>\n<li>Type: Buy X Get Y | Buy: 2 | Get: 1<\/li>\n<li>Conditions \u2192 Category: t-shirts<\/li>\n<\/ul>\n\n<h3>How Buy X Get Y Works<\/h3>\n\n<p>The Buy X Get Y rule uses a <strong>group-based algorithm<\/strong> that always gives the cheapest qualifying items for free.<\/p>\n\n<p><strong>Algorithm (step by step):<\/strong><\/p>\n\n<ol>\n<li><p>All items in the cart are flattened into individual unit prices.\ne.g. Cart: 2\u00d7 T-shirt @ \u20b9200, 1\u00d7 Jeans @ \u20b9800, 1\u00d7 Cap @ \u20b9150\n\u2192 unit prices: [200, 200, 800, 150]<\/p><\/li>\n<li><p>Prices are sorted cheapest-first:\n\u2192 [150, 200, 200, 800]<\/p><\/li>\n<li><p>The number of complete qualifying groups is calculated:\ngroup size = Buy + Get = 3 + 1 = 4\ntotal items = 4 \u2192 floor(4 \u00f7 4) = <strong>1 group qualifies<\/strong><\/p><\/li>\n<li><p>For each group, the cheapest <code>Get<\/code> items are free:\n\u2192 \u20b9150 (cap) is free \u2192 discount applied = <strong>\u2212\u20b9150<\/strong><\/p><\/li>\n<\/ol>\n\n<p>The discount is added as a negative cart fee line item labelled with the rule name, keeping the breakdown transparent to customers.<\/p>\n\n<p><strong>Why cheapest-first?<\/strong><\/p>\n\n<p>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.<\/p>\n\n<p><strong>Only complete groups qualify:<\/strong><\/p>\n\n<p>With Buy 2 Get 1 and 5 items in the cart:\n\u2192 floor(5 \u00f7 3) = 1 complete group \u2192 1 item free (the cheapest)\nThe leftover 2 items do not form a group and get no discount.<\/p>\n\n<p><strong>Configuration examples:<\/strong><\/p>\n\n<ul>\n<li>Buy 1 Get 1 Free        \u2192 Buy: 1, Get: 1<\/li>\n<li>Buy 2 Get 1 Free        \u2192 Buy: 2, Get: 1<\/li>\n<li>Buy 3 Get 2 Free        \u2192 Buy: 3, Get: 2<\/li>\n<li>Buy 4 Get 1 Free (BOGO4)\u2192 Buy: 4, Get: 1<\/li>\n<\/ul>\n\n<p>Combine with a <strong>Product Category<\/strong> condition to restrict the rule to specific product lines (e.g. only T-shirts, only Electronics).<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the <code>mr-j-dev-smart-discount-rules<\/code> folder to <code>\/wp-content\/plugins\/<\/code>.<\/li>\n<li>Activate the plugin through the <strong>Plugins<\/strong> menu in WordPress.<\/li>\n<li>Go to <strong>WooCommerce \u2192 Discount Rules<\/strong> to create rules.<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<\/ul>","raw_excerpt":"Create advanced auto-apply discount rules beyond default WooCommerce coupons \u2014 with role, category, and day-of-week conditions.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/314724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=314724"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/iamdeveloperajay"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=314724"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=314724"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=314724"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=314724"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=314724"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=314724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}