{"id":10737,"date":"2026-05-19T20:30:15","date_gmt":"2026-05-19T12:30:15","guid":{"rendered":"https:\/\/aeosub.com\/mr-j-dev-smart-discount-rules\/"},"modified":"2026-05-19T20:30:15","modified_gmt":"2026-05-19T12:30:15","slug":"mr-j-dev-smart-discount-rules","status":"publish","type":"post","link":"https:\/\/aeosub.com\/zh\/mr-j-dev-smart-discount-rules\/","title":{"rendered":"Mr. J Dev Smart Discount Rules"},"content":{"rendered":"<div class=\"plugin-info-card\" style=\"border: 1px solid #e2e8f0;border-radius: 10px;overflow: hidden;margin-bottom: 30px;font-family: -apple-system, system-ui, sans-serif;background: #fff\">\n<table style=\"width: 100%;border-collapse: collapse;font-size: 14px\">\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 15px 20px;text-align: left;width: 35%;color: #4a5568;background: #fcfcfc\"><img decoding=\"async\" src=\"https:\/\/ps.w.org\/mr-j-dev-smart-discount-rules\/assets\/icon-256x256.png?rev=3537278\" style=\"width: 40px;height: 40px;border-radius: 6px;margin-right: 12px;vertical-align: middle\"> Developer<\/th>\n<td style=\"padding: 15px 20px;font-weight: 500\"><a href=\"https:\/\/profiles.wordpress.org\/iamdeveloperajay\/\" target=\"_blank\" rel=\"noopener\">Mr. J<\/a><\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Version<\/th>\n<td style=\"padding: 12px 20px\">v1.0.0<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Active Installs<\/th>\n<td style=\"padding: 12px 20px\">0 +<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Requires \/ Tested<\/th>\n<td style=\"padding: 12px 20px\">5.8 \/ 6.9.4<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #edf2f7\">\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Last Updated<\/th>\n<td style=\"padding: 12px 20px\">2026-05-19 12:07pm GMT<\/td>\n<\/tr>\n<tr>\n<th style=\"padding: 12px 20px;text-align: left;color: #4a5568;background: #fcfcfc\">Official Link<\/th>\n<td style=\"padding: 12px 20px\"><a href=\"https:\/\/wordpress.org\/plugins\/mr-j-dev-smart-discount-rules\/\" target=\"_blank\" style=\"text-decoration: none;color: #4a3bca;font-weight: bold\" rel=\"noopener\">View Details \u2192<\/a><\/td>\n<\/tr>\n<\/table><\/div>\n<div class=\"plugin-short-desc\" style=\"margin: 20px 0;padding: 12px 15px;background: #f9fafb;border-left: 4px solid #4a3bca;border-radius: 6px;font-style: italic;color: #4a5568\">Create advanced auto-apply discount rules beyond default WooCommerce coupons \u2014 with role, category, and day-of-week conditions.<\/div>\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<p><strong>Discount Types:<\/strong><\/p>\n<ul>\n<li><strong>Percentage<\/strong> \u2014 e.g. &#8220;10% off the entire cart&#8221;<\/li>\n<li><strong>Fixed Amount<\/strong> \u2014 e.g. &#8220;\u20b9100 off cart&#8221;<\/li>\n<li><strong>Buy X Get Y<\/strong> \u2014 e.g. &#8220;Buy 2, get 1 free&#8221; (cheapest eligible items are discounted)<\/li>\n<\/ul>\n<p><strong>Conditions (can be combined):<\/strong><\/p>\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<p><strong>Rule Control:<\/strong><\/p>\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<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<h3>Usage Examples<\/h3>\n<p><strong>Weekend 15% sale for all users:<\/strong><\/p>\n<ul>\n<li>Type: Percentage | Value: 15<\/li>\n<li>Conditions <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> Days: Saturday, Sunday<\/li>\n<\/ul>\n<p><strong>\u20b9500 spend <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> \u20b950 off for Wholesale customers:<\/strong><\/p>\n<ul>\n<li>Type: Fixed | Value: 50<\/li>\n<li>Min Spend: 500 | Conditions <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> Role: wholesale_customer<\/li>\n<\/ul>\n<p><strong>Buy 2 T-shirts, get 1 free (cheapest):<\/strong><\/p>\n<ul>\n<li>Type: Buy X Get Y | Buy: 2 | Get: 1<\/li>\n<li>Conditions <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> Category: t-shirts<\/li>\n<\/ul>\n<h3>How Buy X Get Y Works<\/h3>\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<p><strong>Algorithm (step by step):<\/strong><\/p>\n<ol>\n<li>\n<p>All items in the cart are flattened into individual unit prices.<br \/>\ne.g. Cart: 2\u00d7 T-shirt @ \u20b9200, 1\u00d7 Jeans @ \u20b9800, 1\u00d7 Cap @ \u20b9150<br \/>\n<span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> unit prices: [200, 200, 800, 150]<\/p>\n<\/li>\n<li>\n<p>Prices are sorted cheapest-first:<br \/>\n<span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> [150, 200, 200, 800]<\/p>\n<\/li>\n<li>\n<p>The number of complete qualifying groups is calculated:<br \/>\ngroup size = Buy + Get = 3 + 1 = 4<br \/>\ntotal items = 4 <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> floor(4 \u00f7 4) = <strong>1 group qualifies<\/strong><\/p>\n<\/li>\n<li>\n<p>For each group, the cheapest <code>Get<\/code> items are free:<br \/>\n<span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> \u20b9150 (cap) is free <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> discount applied = <strong>\u2212\u20b9150<\/strong><\/p>\n<\/li>\n<\/ol>\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<p><strong>Why cheapest-first?<\/strong><\/p>\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<p><strong>Only complete groups qualify:<\/strong><\/p>\n<p>With Buy 2 Get 1 and 5 items in the cart:<br \/>\n<span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> floor(5 \u00f7 3) = 1 complete group <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> 1 item free (the cheapest)<br \/>\nThe leftover 2 items do not form a group and get no discount.<\/p>\n<p><strong>Configuration examples:<\/strong><\/p>\n<ul>\n<li>Buy 1 Get 1 Free        <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> Buy: 1, Get: 1<\/li>\n<li>Buy 2 Get 1 Free        <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> Buy: 2, Get: 1<\/li>\n<li>Buy 3 Get 2 Free        <span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> Buy: 3, Get: 2<\/li>\n<li>Buy 4 Get 1 Free (BOGO4)<span aria-hidden=\"true\" class=\"wp-exclude-emoji\">\u2192<\/span> Buy: 4, Get: 1<\/li>\n<\/ul>\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","protected":false},"excerpt":{"rendered":"<p>Create advanced auto-apply discount rules beyond default WooCommerce coupons \u2014 with role, category, and day-of-week conditions.<\/p>","protected":false},"author":1,"featured_media":9317,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[252],"tags":[1364,1365,603,1366,569,555],"class_list":["post-10737","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-trends","tag-auto-apply","tag-buy-x-get-y","tag-discount","tag-pricing-rules","tag-woocommerce","tag-wordpress-plugin"],"_links":{"self":[{"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/posts\/10737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/comments?post=10737"}],"version-history":[{"count":0,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/posts\/10737\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/media\/9317"}],"wp:attachment":[{"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/media?parent=10737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/categories?post=10737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aeosub.com\/zh\/wp-json\/wp\/v2\/tags?post=10737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}