Linux 软件免费装
Banner图

DeftCoders – Discount & Fee Rules for WooCommerce

开发者 deftcoders
更新时间 2026年3月15日 16:27
PHP版本: 7.4 及以上
WordPress版本: 6.9
版权: GPL-3.0-or-later
版权网址: 版权信息

标签

woocommerce dynamic pricing bulk discount discount fees

下载

1.0.0

详情介绍:

DeftCoders – Discount & Fee Rules is a condition-driven pricing engine for WooCommerce. You build rules, each rule has conditions (when it fires) and an action (what it does). When a customer visits the cart or checkout, every active rule is evaluated automatically — fees and discounts are applied without any coupon codes or manual work. Rules run in priority order. A "Stop Further Rules" flag lets any rule break the chain once it fires, giving you full control over stacking and exclusivity. What You Can Do: Real Examples 5 Action Types Fee Rules add charges to the cart: Discount Rules reduce what the customer pays: 14 Condition Types All conditions on a rule must match simultaneously (AND logic). Combine as many as needed. Cart & Order Customer & Checkout Products Date & Time (all use your WordPress site timezone) Per-Rule Settings Admin Dashboard The rules list page shows 8 live stat cards at the top: Total Rules, Active Rules, Inactive Rules, Discount Rules, Fee Rules, Fee Revenue this month, Discounts Given this month, and all-time Net Impact (fee revenue minus discounts). The revenue figures come from completed and processing orders tracked automatically. The rules table shows 10 rules per page with full pagination. Each row shows the rule name, type badge, conditions summary, fee/discount amount, priority number, a live status toggle, and Edit/Delete buttons. Drag any row to reorder priority. A search box filters by rule name in real time. Two dropdowns filter the list by condition type or rule type. Bulk actions at the bottom let you Activate, Deactivate, Delete, or Export any selection of rules in one click. Rule Simulator Test any combination of your rules without touching a real cart. Enter a simulated cart — subtotal, item count, payment method, shipping method, user role, country, coupon code, date, and time — then click Run. The results panel shows every active rule, whether it matched, which conditions were satisfied (or which one failed), the calculated amount, and a complete cart summary: subtotal, total fees, total discounts, and final total. Nothing is written to any real session or order. Debug Tools Preview Mode — enable in Settings to run the full rule evaluation engine on every real cart request, but apply nothing to any actual cart. Safe to use on a live production store. Debug Mode — writes timestamped log entries to wp-content/uploads/wcdpdr-logs/. One file per day. Each entry shows the cart state at evaluation time, every rule evaluated (conditions met or not, amount applied), any Stop Further Rules trigger, and any execution error. Logs are viewable from the Debug Logs admin page and can be cleared with one click. The log directory is protected from direct browser access by a .htaccess file written automatically on first use. Import / Export Export all rules — or a selected subset via bulk export — to a JSON file. Import on any site. Every rule is validated before saving and all fields are sanitised. The 5-rule free limit is respected automatically; imports are trimmed to available slots. Clean Uninstall When you delete the plugin via the WordPress admin, it removes everything it created: both database tables, all plugin options, all transients, and the entire log directory. On Multisite, cleanup runs for every sub-site. Performance Active rules are cached in a 60-second WordPress transient; no database query fires on each cart recalculation. The cache busts immediately whenever a rule is saved, deleted, or its status toggled. Product category conditions use a single batched query across all cart products rather than one query per line item. Compatibility

安装:

  1. In your WordPress admin go to Plugins → Add New → Upload Plugin, select the zip, and click Install Now. Or unzip and upload the deftcoders-dynamic-pricing-conditional-fees folder to /wp-content/plugins/ via FTP.
  2. Click Activate Plugin.
  3. WooCommerce 6.0 or higher must be installed and active. If WooCommerce is missing the plugin deactivates itself and shows an admin notice.
  4. Go to Pricing Rules in the WordPress admin sidebar.
  5. Three example rules are pre-installed as Inactive: Bulk Quantity Discount, Small Order Fee, and Weekend Sale. Activate any you want to use, or click Add New Rule to build your own.

屏幕截图:

  • **Rule builder — conditions** — the Add/Edit modal with multiple conditions already configured. Shows the condition-type dropdown, operator selector, and value input for each row, plus the Add Condition button. Demonstrates how to combine Cart Total, Day of Week, and User Role conditions on a single rule.
  • **Rule builder — tiered discount action** — the action panel with Tiered Discount selected and three quantity brackets fully filled in (5–9 items: 10%, 10–19 items: 15%, 20+ items: 20%). Also shows the Optional Label field, Stop Further Rules checkbox, priority, and status fields.
  • **Rule Simulator — input panel** — the left panel of the simulator with a full cart scenario entered: subtotal, item quantity, payment method, shipping method, user role, country, coupon code, simulation date, and simulation time.
  • **Rule Simulator — results panel** — the right panel showing two matched rules (green checkmarks, conditions met, calculated discount amounts) and one unmatched rule (grey, condition that failed shown). Cart summary table at the bottom: subtotal, total fees, total discounts, final total.
  • **Cart with discount applied** — WooCommerce cart page showing a tiered discount line in the totals ("Bulk Discount (15% Off) −$X"), the savings banner above the totals ("You have saved 15% discount"), and a "You saved X!" message in the applied-rules area.
  • **Cart with fee applied** — WooCommerce cart page showing a conditional fee line in the totals ("Small Order Fee +$3.00") and the custom rule message displayed above the checkout form ("Add $50 worth of items to waive the small order fee.").
  • **Settings page** — four toggle switches (Preview Mode, Debug Mode, Display Savings, Display Countdown Timer), read-only store timezone field, and a compatibility table at the bottom showing WooCommerce version, WordPress version, PHP version, HPOS status, and WPML detection.
  • **Debug logs page** — date-selector dropdown listing available log dates, raw timestamped log content showing rule evaluation entries (rule name, conditions met/not met, amount applied), and a Clear All Logs button.

升级注意事项:

1.0.0 Initial release. No upgrade steps required.

常见问题:

Does this plugin require WooCommerce?

Yes. WooCommerce 6.0 or higher must be installed and active. The plugin checks on every load and deactivates itself automatically if WooCommerce is missing.

What PHP version is required?

PHP 7.4 or higher. If the requirement is not met the plugin shows an admin error notice and loads nothing.

How many rules can I create?

The free version supports up to 5 rules (active and inactive combined). The UI shows a warning when you have reached the limit and blocks creating more until you delete an existing rule.

Can I stack multiple discounts?

Yes, with full control. Each discount rule has a Stackable setting. Stackable (default) calculates against the full cart subtotal regardless of other discounts. Non-stackable calculates against the subtotal minus discounts already applied in the current cycle. Combine this with Stop Further Rules to prevent any stacking at all.

Does "Stop Further Rules" affect both fee and discount rules?

Yes. It stops all rule evaluation — fee and discount rules alike — for every rule that follows in priority order. Once it fires, the loop breaks completely.

Can I test rules without customers seeing anything?

Two ways. The Rule Simulator lets you enter fake cart data and see results instantly — nothing touches any real session. Preview Mode (Settings) runs the full engine on real customer carts but applies nothing; combine it with Debug Mode to log exactly what would have fired.

How does the countdown timer work?

A countdown timer banner appears on the cart when a discount rule has a time-based condition (Day of Week, Date Range, or Time Range). For Day of Week rules it counts down to midnight. For Date Range rules it counts down to 23:59 on the end date. For Time Range rules it counts down to the end time. The timer updates every second via JavaScript.

Where are the debug log files stored?

In wp-content/uploads/wcdpdr-logs/, one file per day named wcdpdr-debug-YYYY-MM-DD.log. The directory is protected from direct browser access via an auto-created .htaccess file. You can view and clear logs from the Debug Logs tab in the admin.

Is this compatible with WooCommerce HPOS?

Yes. The plugin calls FeaturesUtil::declare_compatibility( 'custom_order_tables', ... ) and uses the WooCommerce order object API for all order reads and writes — no direct wp_posts queries.

What happens to my data if I delete the plugin?

Everything is removed cleanly: both database tables, all plugin options, all plugin transients, and the log directory. On Multisite this runs for every sub-site automatically.

Can I transfer my rules to another site?

Yes. Click Export on the rules list page (or use bulk export for specific rules) to download a JSON file. On the destination site use Import to upload it.

Is the plugin compatible with Multisite?

The uninstall routine runs per-site on Multisite, cleaning up data for each sub-site. The plugin itself operates per-site (rules are stored per-site in the standard WordPress manner).

更新日志:

1.0.0