An online shop suddenly turns sluggish, pages take ten seconds to load or not at all, and the backend stops responding. Cloudflare is active, a bot protection with country filter and rate limit is running, a cache is set up. Still the server is under full load. Exactly this happened recently to a WooCommerce shop carrying a few thousand products.
The surprising part: it was not a classic DDoS attack. It was only a handful of bots, at peak a few hundred requests per minute. Any decent server handles that as long as the requests are cheap. These bots, however, hit the most expensive queries a WooCommerce shop has to offer. This post shows what those weak spots are, why the usual protection layers do nothing against them and what actually helps.
Is your shop affected right now and you need help fast? Log analysis and shop protection:
The scenario: full load without a rush of visitors
The starting point is typical for many small and mid-sized shops:
- WooCommerce with a few thousand products and filter navigation by attributes such as brand, origin, vintage or size
- Cloudflare in front of the server, plus a bot protection with country filter, challenge and rate limit
- A page cache through a plugin, plus an object cache with Redis
The shop slowed down whenever “the search” was used, or so it seemed at first. The Redis cache had filled up to 2 GB and had to be switched off, which made things even worse.
Only the analysis of the access log brought clarity: the regular shop search had been used exactly twice that day. The load came from two entirely different patterns that together made up almost 60% of all requests. And over 80% of the bot requests were URLs that were called only once.
Weak spot 1: the public Store API
WooCommerce ships a JSON interface that anyone can call without logging in: the Store API at /wp-json/wc/store/v1/. It is meant for the block cart and block checkout. But it also returns products and accepts a free search term:
GET /wp-json/wc/store/v1/products?search=Product%20name%20variant&per_page=20
This is not a security hole in the strict sense but a design decision. For bots, though, it is an invitation:
- The bot sends product names as search terms, across the entire range of the industry, including items the shop does not carry at all.
- WordPress searches with
LIKE '%term%'in the title, short description and content of all products. There is no index for that, so the database reads the whole table every time. - For every match, WooCommerce loads prices, stock, images and attributes, which means dozens of additional queries.
- The response is JSON. A Cloudflare challenge or captcha cannot be shown there, so the request goes through.
In this case that meant more than 8,000 requests in one day with more than 6,500 different search terms. A single sender, disguised as an ordinary desktop browser, never with a referrer, at peak 360 requests per minute.
The purpose is almost always price monitoring: competitors or data brokers compare prices and availability without respecting robots.txt or any agreement.
Weak spot 2: unlimited filter combinations
The WooCommerce filter navigation (layered nav) appends every selection to the URL as a parameter. Every combination is a new, valid page that the server calculates from scratch:
/category/example/?filter_brand=a&filter_vintage=2003,2004,2021,2022,2023
&filter_origin=austria&filter_size=075&query_type_vintage=or&...
This is how it becomes a problem:
- A crawler follows the filter links on every category page. Every result page again contains filter links with one more value, and the crawler goes deeper and deeper.
- With nine filters of 5 to 30 values each, millions of possible URLs come together. None of them is requested twice.
- Every page needs queries across several attributes plus the counts for every single filter value, a dozen heavy database joins per request.
- Fake browser identifiers and rotating IP addresses get around country filters and rate limits.
In this case there were more than 21,000 filter requests in one day, almost 18,000 of them with a different URL. Typical were 3 to 9 filters at once, and the longest addresses had more than 1,000 characters. Behind them were AI and SEO crawlers as well as bots with fake browser identifiers, some with Chrome versions that do not even exist yet. The robots.txt already disallowed the filter URLs. None of these bots respected it.
Often this is not a targeted attack at all but a badly built crawler. For the shop, it makes no difference.
Weak spot 3: caches that fill up
WooCommerce stores the results of the filter counts as transients so the same combination is faster the next time. For real customers that makes sense. With millions of unique combinations it becomes a trap:
- With Redis: every combination creates new entries. If Redis runs with the default setting
noeviction, memory grows until nothing works anymore. - Without Redis: the same entries end up in the
wp_optionstable. It bloats, and every page of the shop gets slower because WordPress reads this table on every request.
Why Cloudflare, caching and captchas are not enough here
Both patterns are built so that the usual protection layers miss. The load does not come from volume but from every single request being expensive and unique. Just three parallel bots can slow down a shop.
| Protection layer | Why it fails here |
|---|---|
| Page cache (plugin or Cloudflare) | URLs with parameters are usually not cached at all. And even if they were: with over 80% unique URLs there are no hits. |
| Object cache (Redis) | Every combination creates new entries, the cache fills up instead of taking load off. |
| Challenge, captcha | No challenge can be shown on JSON interfaces. Bots with a real browser engine pass some of them. |
| Country filter | The bots come from data centers in allowed countries such as Germany, the Netherlands or Austria. |
| Rate limit per IP | Rotating IP addresses each stay under the limit. |
robots.txt |
Ignored by exactly these bots. |
The consequence: more cache or a stronger server only shifts the problem. The only effective measure is to limit the number of possible expensive requests before WordPress even processes them.
How to protect your shop
The measures are sorted by impact. In the case described, the first two were enough on their own. The basic rule: reject as early as possible, ideally at Cloudflare before the server has to do any work.
1. Block Store API search for outsiders
Shops with a classic cart (shortcode, Elementor or a classic theme) do not need the public product search of the Store API. A Cloudflare rule under Security → WAF → Custom Rules with the action Block is enough:
(http.request.uri.path contains "/wp-json/wc/store/"
and http.request.uri.query contains "search="
and not ip.src in $partner_ips)
If you use the block cart and block checkout, do not block across the board but only let requests with a valid WooCommerce nonce through. The plugin in the next section takes care of that.
2. Put a hard limit on filter combinations
Real customers rarely set more than two or three filters at once. Anything beyond that is practically always a crawler.
- Cloudflare, Block: reject overly long filter URLs:
(http.request.uri.query contains "filter_" and len(http.request.uri.query) gt 300) - Cloudflare, Rate Limiting: limit requests with
filter_per IP, for example to 20 per minute. How finely period and block duration can be set depends on your Cloudflare plan. - In the shop as a second line: a small must-use plugin that rejects too many filters with status 400 and only allows Store API search with a valid nonce.
<?php
// wp-content/mu-plugins/shop-bot-limits.php
if (!is_admin() && !wp_doing_ajax()) {
$filters = array_filter(array_keys($_GET), fn($k) => str_starts_with((string) $k, 'filter_'));
$tooMany = count($filters) > 3 || strlen($_SERVER['QUERY_STRING'] ?? '') > 300;
foreach ($filters as $k) {
if (!is_string($_GET[$k]) || substr_count($_GET[$k], ',') > 2) {
$tooMany = true;
}
}
if ($tooMany) {
status_header(400);
nocache_headers();
exit('Too many filters at once.');
}
}
add_filter('rest_pre_dispatch', function ($result, $server, $request) {
if (str_starts_with($request->get_route(), '/wc/store/v1/products')
&& $request->get_param('search') !== null
&& !is_user_logged_in()
&& !wp_verify_nonce((string) $request->get_header('nonce'), 'wc_store_api')) {
return new WP_Error('forbidden', 'Not allowed', ['status' => 403]);
}
return $result;
}, 10, 3);
3. Make filter links unattractive to crawlers
- Serve filter pages with
noindexand give filter linksrel="nofollow", so reputable crawlers do not go deeper. - Disallow the filter URLs in
robots.txt, for example withDisallow: /*?*filter_andDisallow: /*?*query_type_. This only stops well-behaved bots but costs nothing. The robots.txt checker shows whether your rules apply.
4. Configure caches so they do not fill up
- Always run Redis with a fixed limit and eviction:
maxmemory 256mbandmaxmemory-policy allkeys-lru. Old entries are then dropped instead of memory filling up. - Do not store filter counts for deep combinations at all. WooCommerce offers the filter
woocommerce_layered_nav_count_maybe_cachefor this. - Without Redis, clean up regularly: delete expired transients and optimize the
wp_optionstable afterwards. - Cache pages without parameters as HTML at Cloudflare and only bypass the cache when a WooCommerce cart or session cookie is set. This makes category and product pages noticeably faster for real visitors.
5. Reduce base load and make the log useful
- Switch WP-Cron to a real cron: with
define('DISABLE_WP_CRON', true);inwp-config.phpand a cron job at your host every five minutes. Otherwise every page view triggers the internal tasks; in the case described that was more than 1,600 extra requests per day. - Write the real visitor IP to the log: behind Cloudflare, the server log otherwise only shows Cloudflare addresses. With
mod_remoteipand the Cloudflare IP ranges, the culprits can be identified clearly.
Exceptions for welcome partners
Not every bot is unwanted. Price comparison portals bring customers and should still be able to fetch prices. But they must not become a back door for everyone else.
- Never allow by user agent alone. Any scraper can pretend to be a known partner bot. Only allow when IP address and user agent match.
- Maintain the IP list centrally: create it as a list in Cloudflare (
$partner_ipsin the example above) and exclude it in every block, challenge and rate limit rule. - Check the real IP properly in the shop: only trust the
CF-Connecting-IPheader when the request really comes from a Cloudflare address. Otherwise anyone can bypass the proxy and pose as a partner. - Better: a feed instead of crawling. Most comparison portals accept product feeds as CSV or XML. A feed plugin generates a static file a few times a day. That causes no database load, and the Store API can stay blocked for everyone else.
Customers who arrive through a comparison portal are never affected by any of this, by the way: they open regular product pages, and none of the rules above blocks those.
Checklist for your shop
- Store API search (
/wp-json/wc/store/withsearch=) blocked for outsiders or secured with a nonce - Cloudflare rule against overly long filter URLs and rate limit on filter requests active
- Must-use plugin with filter limit installed, limits checked against your own log
- Partner IPs maintained as a list, exceptions only with IP and user agent
- Filter pages
noindex, filter linksnofollow,robots.txtdisallowsfilter_ - Redis with
maxmemoryandallkeys-lru, or expired transients deleted regularly - WP-Cron switched to system cron
- Real visitor IP in the access log
Early warning signs in the access log
If you look at your log regularly, you will see an attack wave coming before the shop goes down. These rules of thumb have proven useful:
| Signal | Rule-of-thumb threshold |
|---|---|
Requests to /wp-json/wc/store/v1/products?search= |
more than a handful per hour without a referrer |
| Share of filter URLs among all page views | over 30% |
| Share of unique filter URLs | over 70% |
| Filter parameters per URL | regularly 4 or more |
| Browser identifiers with unknown versions | for example Chrome versions that do not exist yet |
A quick test: count one day of the access log by request type (filters, Store API, search, regular pages) and by user agent. The distribution usually shows after a few minutes of analysis which pattern causes the load.
Conclusion
Bot attack waves on online shops are rarely a matter of volume. It gets dangerous when bots find the expensive, uncacheable requests, and WooCommerce has two of those with the open Store API and the unlimited filter navigation. Limit those two places and the bots lose their leverage. Cache and hardware then help again where they belong: with your real customers.
Managed WordPress hosting already includes a local bot protection that is switched on in full during an attack wave. For existing shops, WooCommerce maintenance covers updates, monitoring and exactly this kind of protection.




