Skip to main content
Zass Tech
Free audit
Web Development5 min read

How to Stop Bots From Overloading a WooCommerce Store

By Shakh Farid·November 18, 2026·0 views
#WooCommerce#Bots#Cloudflare#robots.txt#Server Load#Security

Short answer: Bots overload WooCommerce stores mostly by requesting URLs that can't be cached: ?add-to-cart= links, filter and sort combinations, and search pages. Stop them in layers: mark cart links nofollow, disallow them in robots.txt, return a 403 to bot user agents that request add-to-cart URLs, and put Cloudflare's Bot Fight Mode in front. Don't block search engines from your product and category pages.

Why bots hurt shops more than blogs

On a blog, almost every URL a bot visits is a cacheable article. On a WooCommerce store, many URLs aren't:

  • ?add-to-cart=123 links on the shop page. Each one starts a WooCommerce session, writes to the database and skips the page cache.
  • Filter and sort combinations like ?orderby=price&filter_color=blue. A crawler can generate thousands of these.
  • Site search (?s=...), which runs a database query every time.

A crawler that follows every link on a shop page can easily produce more uncached requests in an hour than real customers do in a day. On shared hosting with CPU and process limits, that's enough to get an account throttled or suspended. That's exactly what happened on a store I work on (the suspension story).

How to tell if bots are the problem

Look at your access log (cPanel's "Raw Access" or "Visitors," or your host's log viewer) or at Cloudflare's analytics if you use it. Warning signs:

  • many requests with add-to-cart= in the URL from user agents containing bot, crawl or spider;
  • the same IP or the same user agent hitting hundreds of filter URLs;
  • traffic spikes at night when your customers are asleep;
  • high CPU on your hosting dashboard that doesn't line up with orders.

The four layers

Layer 1: rel="nofollow" on cart links

The "Add to cart" buttons on product cards are real links. Adding rel="nofollow" tells well-behaved crawlers not to follow them. WooCommerce's default buttons already include it; custom product cards often don't. Check yours:

<a href="?add-to-cart=123" class="add_to_cart_button ajax_add_to_cart" rel="nofollow">Add to cart</a>

Layer 2: robots.txt

Ask polite crawlers to stay out of cart actions and private pages:

User-agent: *
Disallow: /*add-to-cart=*
Disallow: /cart/
Disallow: /checkout/
Disallow: /my-account/

WordPress generates robots.txt virtually, so you can add these lines with the robots_txt filter in your theme instead of uploading a file. Don't disallow /shop/, /product/ or /product-category/. Those are the pages you want indexed.

Layer 3: a 403 for bots on add-to-cart URLs

Plenty of bots ignore robots.txt. This small function stops them before WooCommerce touches the cart:

add_action( 'init', function () {
    if ( ! isset( $_GET['add-to-cart'] ) ) {
        return;
    }
    $ua = isset( $_SERVER['HTTP_USER_AGENT'] ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
    if ( preg_match( '/bot|crawl|spider|slurp|facebookexternalhit/', $ua ) ) {
        status_header( 403 );
        exit;
    }
}, 1 );

It runs early (priority 1 on init), only on add-to-cart URLs, and only for user agents that identify as bots. Real shoppers aren't affected, and neither is the AJAX add-to-cart button, which uses a different endpoint (?wc-ajax=add_to_cart).

Bots that fake a browser user agent will get past this layer. That's what layer 4 is for.

🎯
Zass Tech service
Google Ads Management

Full-funnel campaign management, from setup to scaling spend profitably.

→

Layer 4: Cloudflare Bot Fight Mode

Cloudflare's free plan includes Bot Fight Mode (under Security > Bots). It challenges traffic that Cloudflare's network has identified as automated, before it reaches your server. Verified good bots such as Googlebot and Bingbot are allowed through.

To use it, your site's DNS has to run through Cloudflare with the proxy (orange cloud) on for the website records. I covered that setup in the Cloudflare guide for WooCommerce.

Make sure what's left is cached

Blocking bots reduces load. Caching makes the remaining requests cheap. Together they're what kept the store stable. With a working page cache, a bot crawling product pages gets static HTML and costs almost nothing. See which WooCommerce pages to cache and which to exclude.

Things not to do

  • Don't block Googlebot or Bingbot from product and category pages to "save resources." You'll save CPU and lose your search traffic.
  • Don't block every request without a user agent unless you've checked your logs. Some payment gateway callbacks and uptime monitors send unusual user agents.
  • Don't turn on Cloudflare's "Under Attack" mode as a permanent fix. It shows a challenge page to every visitor and should only be used during an actual attack.
  • Don't rely on one layer. robots.txt alone does nothing against rude bots, and a user-agent check alone does nothing against bots that pretend to be Chrome.

FAQ

Why do bots add products to the cart?

They don't do it on purpose. Crawlers follow every link they find, and "Add to cart" buttons on shop pages are links (?add-to-cart=ID). Each visit triggers WooCommerce's cart code.

Will blocking bots hurt my SEO?

Not if you only block cart actions, checkout and account pages. Keep product, category and content pages open to search engines.

Is Cloudflare Bot Fight Mode safe for WooCommerce?

For most small shops, yes. It lets verified search engine bots through and challenges known automated traffic. If a payment gateway or external service stops working after you enable it, check Cloudflare's security events for blocked requests from that service.

How do I add rules to robots.txt in WordPress without a file?

Use the robots_txt filter in your theme or a small plugin to append lines to the virtual robots.txt WordPress generates. An SEO plugin like Yoast also has a robots.txt editor.


Based on load problems I fixed on a live Bangladeshi stationery e-commerce store. If bots or traffic spikes keep taking your shop down, my web development service can help.

📊
Zass Tech service
GA4 & GTM Setup

Clean, accurate tracking infrastructure that reports numbers you can trust.

→

Found this useful?

Share it with someone who's fighting the same tracking headaches.

Shakh Farid

Written by

Shakh Farid

Founder, Zass Tech

More from Shakh →