Developers · What No bots in the cart does
Developers
No Bots In The Cart
Which requests the Edge Observer treats as cart and checkout actions, what a refused request gets back, and how to switch it off.
Requests It Covers
With the setting on (Settings, Bots, No bots in the cart), the Edge Observer looks at these requests before they reach the store:
- Add-to-cart links and forms: a
?add-to-cart=query,?wc-ajax=add_to_cart, and a form post with anadd-to-cartfield. - The WooCommerce Store API cart:
POST /wp-json/wc/store/cart/add-itemand/cart/batch, with or without a version such as/v1/, and the same routes through?rest_route=. - Checkout and payment: the WooCommerce checkout post, the Store API
/checkoutroute and the payment routes Checkout Guard watches.
Other requests, including /wp-admin/, wp-login.php, comments and other /wp-json/ routes, are never touched by this setting.
What A Refused Request Gets
A refused request never reaches the store. It gets HTTP 403. Ajax, Store API, rest_route and checkout requests, and any request that asks for JSON, get a body WooCommerce’s own scripts already know how to show as an error:
{
"code": "cart_refused",
"message": "We couldn't add this to your cart from your current connection. If you're using a VPN, turn it off and reload the page. If your browser is out of date, update it. Or contact the store.",
"result": "failure",
"messages": "<ul class=\"woocommerce-error\"><li>...</li></ul>",
"error": true
}A plain add-to-cart link gets a short HTML page with the same message, a Back to the store link and noindex, so search engines never list it.
If you call the Store API from your own front end, handle cart_refused like any other Store API error and show message to the shopper.
Logs, Bans And The Switch
- Each refusal is listed on the Checkout Guard list with its time, address, network and reason, and never counts toward the card-testing alarm.
- The address is banned through the same ban list as Auto-ban, with the reason Put items in a cart as a bot, and the ban reaches the Edge Observer and the WordPress plugin like any other. Unban it from Banned.
- Your own addresses, your servers, verified crawlers and bots marked Mine are never banned by it. Google’s StoreBot, which adds items to check prices for free listings, is let through.
- It is on by default. Turn it off per site in Settings, Bots, or through the Stattery MCP with the switch
no_bots_in_cart. The Edge Observer picks up the change within a few seconds. - It needs the Edge Observer. Without it nothing is refused.
Related: Enforce robots.txt, Unlock codes.