Version: 1.0.3 | Requires: WordPress 6.5+ · WooCommerce 8.0+ · PHP 7.4+ | Author: Amit Chauhan
CheckoutGuard is a lightweight 3-in-1 WooCommerce plugin: stop RTO fraud with a pincode blacklist and conditional COD, grow gift orders with 1-click duplicate orders and multi-address shipping, and lock stock with a real cart reservation timer. It works with the block-based (Blocks) cart/checkout and the classic shortcode checkout, and is HPOS-ready.
What CheckoutGuard does
CheckoutGuard is a lightweight 3-in-1 WooCommerce plugin for small D2C stores that want a one-time price, not another SaaS subscription:
- Fraud Guard — pincode blacklist & conditional COD (stop RTO fraud).
- Gifting — 1-click duplicate order & multi-address shipping (grow gift orders).
- Reservation timer — a real cart inventory lock (stop overselling).
All three modules work with the block-based (Blocks) cart/checkout and the classic shortcode checkout, and the plugin is HPOS-ready.
Installation
- Upload the
checkout-guard-woocommercefolder to/wp-content/plugins/, or install the ZIP via Plugins → Add New → Upload Plugin. - Activate the plugin. WooCommerce 8.0 or higher must be installed and active.
- Go to WooCommerce → CheckoutGuard to configure the three modules.
On activation CheckoutGuard creates two small database tables (cgw_reservations, cgw_fraud_log) and schedules its cleanup jobs on Action Scheduler. No data is ever sent to a third party.
Quick start
- General tab — turn on the modules you need. Each module can be enabled or disabled independently; a disabled module loads nothing.
- Fraud Guard tab — add your first rule (see below) and, if you have a list of risky pincodes, import them via CSV.
- Gifting tab — set the maximum copies per order and the gift-message / price-hide defaults.
- Reservations tab — set the timer length (default 15 minutes) and the payment window (default 30 minutes).
- Test on a staging order before going live — place a test order with a blocked pincode and confirm COD disappears.
Module A — Fraud Guard (pincode blacklist & conditional COD)
Rules
Each rule matches on one or more conditions:
- Pincode — exact (
110001), range (110001–110096), or wildcard/prefix (1100*). - Suburb / city / state — match by location name.
- Email or phone — match a customer directly (manual entries and auto-learned entries).
- Condition groups — combine the above with cart value, product/category, and user role.
Rules run in priority order (top rule wins); each rule can be individually enabled or disabled.
Actions (per rule)
| Action | What happens |
|---|---|
| Disable COD | COD is hidden for matching checkouts; the customer must pay online. |
| Block checkout | The order cannot be placed at all. |
| Add COD fee | A fee is added when COD is chosen. |
| Partial COD | The order is placed on hold until the customer pays the advance percentage; the store collects the advance manually (e.g. by sending a payment link) and then moves the order to Processing. The rest stays COD. |
Checkout behaviour (A1)
WooCommerce does not refresh payment gateways when the postcode changes — CheckoutGuard does. When a customer types a blocked pincode, COD disappears without a page reload; typing an allowed pincode brings it back. This works on classic and Blocks checkout. The message shown is customisable (“COD is not available for your pincode — please pay online.” by default).
Postcode matching is normalised (spaces and dashes stripped, uppercased). The shipping postcode is used when present, otherwise the billing postcode.
Server-side enforcement (A2)
The blacklist is enforced at order creation, not just in the gateway list — so a headless store, mobile app, or REST API call cannot bypass it. A COD order with a blocked pincode is rejected server-side with a clear error on classic checkout, Store API / Blocks, and REST API (via the pre-insert gate). Orders created programmatically (e.g. wc_create_order() or a direct import) cannot be rejected before creation — CheckoutGuard fails them immediately after creation and logs the attempt, so they can never complete as normal orders.
RTO auto-learn
When an order is cancelled after dispatch, refused, or marked RTO, the pincode/phone risk counter increments. Abandoned checkouts and failed payments do not count. When it crosses your threshold, the entry is auto-blacklisted — or queued for your approval first, depending on the setting. Risk counters are visible in the admin dashboard widget.
CSV import / export
Import and export up to 5,000 entries at once (columns: pincode, type, reason, action). Rows past the 5,000-entry cap are skipped, and the import tells you how many were imported and skipped — with the skips broken down by reason (invalid format, duplicates, over the entry limit). Use the export to back up your blacklist or move it between stores.
Fraud Log
Every blocked attempt is recorded — pincode, reason, rule, time, and channel (checkout or api) — in the Fraud Log tab. Export the log as CSV for analysis.
Module B — Gifting (1-click duplicate order & multi-address)
1-click duplicate
“Send same order as gift” on cart/checkout duplicates the cart in one click with:
- a second shipping address,
- a gift message (saved per copy),
- a price-hide option (the receiver’s packing slip shows no prices — every gift order has a built-in printable packing slip, linked from the admin order view, which never shows prices),
- a gift-wrap flag.
Note: price-hide affects only the built-in packing slip. WooCommerce order emails and third-party PDF invoice plugins are not modified — their documents still show prices.
Logged-in customers can reuse addresses from their saved address book; guests enter addresses manually.
Multi-address
One order can ship to N addresses. Each address gets its own shipping method, cost, and tax rate.
- Shipping (B1): calculated on each destination’s own subtotal, never the aggregate cart total. Example: “Free shipping over $50” with $30 + $30 across two addresses gives free shipping to neither address — freeing on the $60 aggregate would lose the merchant money.
- Tax (B2): calculated on each package’s destination (US state rates, EU VAT, India GST state-wise). Order totals show a per-address tax breakdown in the admin view and in customer order emails.
- Admin: the order view shows a per-address breakdown (which item went where) so fulfilment stays simple.
- Virtual/downloadable products are excluded from multi-address. Coupons apply once on the order total, never per copy.
Works on classic and Blocks checkout.
Module C — Reservation timer (real inventory lock)
How it works
When a customer adds a product to the cart, its stock is genuinely reserved — other shoppers see the reduced availability (stock − active reservations). This is a real lock, not a cosmetic countdown.
- Timer: configurable 1–120 minutes, default 15. A live countdown (mm:ss) shows on cart, checkout, and mini-cart.
- On expiry: the item is automatically removed from the cart and the stock is released.
- On purchase: the reservation converts to a normal sale — stock is never deducted twice.
- Variation-level locking (C2): reserving a “Small” shirt locks only Small’s stock; Large and Medium are untouched. The monitor shows the variation name.
Scope & rules
- Scope: global, per-product, or per-category.
- Low-stock-only mode: lock stock only when the product’s stock is at or below your threshold.
- Role exclusions: exclude roles such as admin or wholesale from reservations.
- Checkout-start extension: optionally extend the timer when the customer starts checkout.
- Backorders: backordered products are never reserved.
Pending payment (C1)
A customer who abandons on a hosted Stripe/PayPal page leaves the order pending. After the payment window (default 30 minutes), CheckoutGuard auto-cancels the order and releases the stock.
CheckoutGuard never overrides WooCommerce’s own “Hold stock (minutes)” setting. Both timers run; whichever fires first cancels the unpaid order, and the other action no-ops on the already-cancelled order. If WooCommerce Hold stock is disabled (0), CheckoutGuard’s payment window is the only timer.
Keep Hold stock at or above the payment window: if Hold stock is shorter, WooCommerce cancels the order first, so the effective payment window is the shorter Hold stock value. The late-payment stock check still runs for those orders — the window-cancel marker is stamped on any cancel of a checkout-linked pending order, not only on window cancels. The Reservations tab warns you when Hold stock is shorter than the payment window.
If a payment arrives late (after the window), the webhook is handled gracefully: if payment arrived, the order is restored/completed; otherwise it stays cancelled. Stock is never deducted twice.
Reservations Monitor
WooCommerce → CheckoutGuard → Reservations Monitor lists active reservations (product + variation name, quantity, session, time left) with manual release and an expiry log.
Performance
One custom table with indexed expiry; cleanup runs via Action Scheduler (not WP-Cron, so it is reliable even on low-traffic stores); stock checks are a single cached query.
Settings export / import & reset
- General tab → Export settings downloads your settings as JSON (module toggles and every tab’s settings). Fraud rules and the blacklist are not in that file — export those separately as CSV from the Fraud Guard tab.
- Import settings restores a JSON export — useful for moving config between staging and live. Settings the file omits keep their current values.
- Reset restores factory defaults (rules and logs are not touched).
Data & privacy
- All data stays in your own WordPress database. CheckoutGuard makes no external calls and sends nothing to any third party.
- Deactivation never deletes data. On uninstall you choose whether to keep or delete your settings, rules, and logs (General tab → “Delete data on uninstall”). Order history is always kept either way — gift copies, advance payments, and fraud markers on past orders are part of the order record and are never removed.
- The fraud log and reservations tables are only removed on uninstall when you choose to delete data.
Troubleshooting
| Symptom | Check |
|---|---|
| COD still shows for a blocked pincode | Is the rule enabled, and is its priority above any conflicting rule? Is the module enabled on the General tab? Is the postcode normalised (spaces/dashes are stripped automatically)? |
| COD hides but the customer can still order COD via an app/API | The A2 server-side validation rejects such orders at creation — check the Fraud Log (channel api) for the rejection. |
| Reservation timer not showing | Is the Reservations module enabled, and is the product in scope (global / its category / per-product)? Backordered products are never reserved. |
| Item not released after expiry | Check Action Scheduler is running (WooCommerce → Status → Scheduled Actions). Cleanup runs on Action Scheduler, not WP-Cron. |
| Pending order not auto-cancelled | Check the payment window setting (default 30 min) and that Action Scheduler is running. WooCommerce’s own Hold stock timer may fire first — that is by design. If Hold stock is shorter than the payment window, the Reservations tab shows a warning (see Pending payment above). |
| Multi-address shipping looks wrong | Shipping is per destination subtotal by design (B1). A free-shipping threshold is evaluated per address, not on the cart total. |
Support
CheckoutGuard is sold with support via the marketplace you purchased it from (WPBay / Gumroad / CodeCanyon). Include your WordPress, WooCommerce, and PHP versions and a description of the steps to reproduce the issue.
Try it on the demo store
This documentation lives on the live demo store — every feature below can be tried right now, no login needed:
- Reservation timer: add the Leather Wallet ($45) to the cart and watch the live “Reserved for 14:59” countdown on the cart page.
- COD disappears by pincode: at checkout, enter pincode 110001 — Cash on Delivery hides without a page reload; change it back to any other pincode and COD returns.
- Partial COD: enter pincode 400002 — the order asks for a 50% advance and waits on-hold (the merchant collects the advance manually, e.g. via a separate payment link).
- Gifting & multi-address: on the cart page, open “Send as a gift / ship to multiple addresses” to duplicate the order as a gift or split items across two addresses — each address gets its own shipping and tax.
- Classic checkout: the same features work on the classic checkout page.
Frequently asked questions
Does it work with the block-based cart and checkout?
Yes. CheckoutGuard supports both the Blocks cart/checkout and the classic shortcode checkout.
Does it work with HPOS (High-Performance Order Storage)?
Yes. CheckoutGuard declares HPOS compatibility and uses the WooCommerce order APIs throughout.
What happens to my data if I deactivate the plugin?
Nothing. Deactivation never deletes data. On uninstall you can choose whether to keep or delete your settings, rules, and logs (General tab → “Delete data on uninstall”). Order history is always kept — gift copies, advance payments, and fraud markers on past orders are part of the order record and are never removed.
Does the plugin send data to any third party?
No. All data stays in your own WordPress database. CheckoutGuard makes no external calls.
Why does COD disappear when I type a pincode?
A Fraud Guard rule matches that pincode. WooCommerce does not refresh payment gateways on postcode change by itself — CheckoutGuard triggers the refresh, so COD hides or shows without a page reload.
Can a headless store or mobile app bypass the pincode blacklist?
No. The blacklist is enforced server-side at order creation on every channel (classic checkout, Store API, REST API), not only in the gateway list.
How is shipping calculated for multi-address orders?
Per destination subtotal — never the aggregate cart total. A “free shipping over $50” rule with $30 + $30 across two addresses gives free shipping to neither address.
How is tax calculated for multi-address orders?
Per package destination. Each address is taxed at its own local rate, and the order totals show a per-address breakdown.
Does the reservation timer conflict with WooCommerce’s “Hold stock” setting?
No. CheckoutGuard never overrides it. Both timers run; whichever fires first cancels the unpaid order, and the other action no-ops on the already-cancelled order. If WooCommerce Hold stock is disabled, CheckoutGuard’s own payment window (default 30 minutes) is the only timer. One thing to watch: keep Hold stock at or above the payment window — if Hold stock is shorter, WooCommerce cancels the order first, so the effective payment window is the shorter Hold stock value (the late-payment stock check still runs for those orders). The Reservations tab warns you when that is the case.
What happens if a customer pays after the payment window?
The late payment is handled gracefully: if payment arrived, the order is restored/completed; otherwise it stays cancelled. Stock is never deducted twice. (This stock check runs on any cancelled checkout-linked order, whichever timer cancelled it — see the Hold stock answer above.)
Does reserving a variation lock the whole product?
No. Reservations are variation-level: reserving “Small” locks only Small’s stock.