Customer Blacklist & Payment Control WordPress Function
What it does?
-
Order-side toggle: Adds a “Customer Status” box on the order page with a one-click button to add/remove the customer from a blacklist.
-
Secure role switch: Uses permissions and nonce validation, updates the user’s status via AJAX, reloads the page, and confirms the action.
-
Action logging: Writes an admin-readable log entry whenever a user is blacklisted or restored.
-
Checkout restrictions: For logged-in blacklisted users, removes Cash on Delivery from available payment methods and displays an informational notice.
-
Role bootstrap: Ensures a dedicated “blacklisted customer” role exists so the flow works reliably across environments.
-
Graceful handling: Shows clear messages for guest orders and non-customer users, avoiding confusion.
Why it’s useful?
-
Risk control: Prevents high-risk customers from selecting immediate-settlement methods like COD, lowering refunds and disputes.
-
Operational clarity: Puts the control where staff work—on the order—speeding decisions during review or fulfillment.
-
Reversible & auditable: One click to revert; each change is logged with who did it and when.
-
Better customer comms: A polite checkout notice explains why some payment options aren’t available, reducing support friction.
