Get a free 14-day trial on a wide range of WooCommerce Marketplace extensions and themes. Explore products

Fraud prevention WP-CLI commands

Use WP-CLI to inspect and delete recorded payment attempts and manage custom allow and block rules for fraud prevention.

Note:

This is a Developer level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customizations. We are unable to provide support for customizations under our Support Policy.

Before you start

↑ Back to top

Fraud prevention is currently available on WordPress.com stores running on WP Cloud. You need access to WP-CLI on the store and fraud prevention version 0.3.3 or later with the merchant-facing feature enabled. See WordPress.com SSH access for access requirements and connection instructions. Run the commands from your WordPress installation.

Replace the example email addresses, IP addresses, and IDs with the values for your task. For command options and supported output formats, use the built-in help for each command, for example:

wp help wc fraud-protection payment-attempts list
wp help wc fraud-protection custom-rules create

Inspect payment attempts

↑ Back to top

List recorded payment attempts or filter by an exact email address or IP address:

wp wc fraud-protection payment-attempts list
wp wc fraud-protection payment-attempts list --email=shopper@example.com
wp wc fraud-protection payment-attempts list --ip=192.0.2.1

By default, the list shows up to 20 attempts from the past 30 days. Use --limit to show more results and --days to change the time window. Use --format=count to count matches within that window. Email matching ignores letter case; IP matching accepts equivalent address notation.

Use the attempt ID from the list to inspect one record:

wp wc fraud-protection payment-attempts get 123

Delete payment attempts

↑ Back to top

To delete an individual recorded attempt, use its ID:

wp wc fraud-protection payment-attempts delete 123

You can also delete by email address or IP address. This deletes every matching recorded attempt, including records outside the list command’s default time window and result limit. First inspect matches using the exact --email or --ip filter, adjust --days and --limit as needed, and review the count in the confirmation prompt before proceeding. For a specific record, use its ID instead.

wp wc fraud-protection payment-attempts delete shopper@example.com
wp wc fraud-protection payment-attempts delete 192.0.2.1

The command asks for confirmation and reports its result. Run the relevant list or get command again to check the store’s recorded activity. Deleting an attempt removes the store’s recorded payment activity; it does not delete custom rules or necessarily delete WooCommerce logs or data held by the verification service.

Manage custom rules

↑ Back to top

List rules or inspect one by ID:

wp wc fraud-protection custom-rules list
wp wc fraud-protection custom-rules get 123

Create an allow or block rule for an email address or IP address. The command detects the type from the value:

wp wc fraud-protection custom-rules create allow shopper@example.com
wp wc fraud-protection custom-rules create block 192.0.2.1

To change a rule, provide its ID and a new --action, --value, or both. To remove it, use its ID and confirm the prompt:

wp wc fraud-protection custom-rules update 123 --action=block
wp wc fraud-protection custom-rules delete 123

List or inspect the rule again to verify your change. Removing a rule changes how future matching attempts are handled; it doesn’t remove previously recorded payment activity.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.