Hello @pckeycallout,
By default, WooCommerce plugin generates standard HTML links for the “Add to Cart” buttons in the product loops (shop, categories, and taxonomies). Even when AJAX add-to-cart is enabled, WooCommerce retains the ?add-to-cart=ID parameter within the href attribute as a fallback mechanism for users who might have JavaScript disabled. Search engine crawlers, such as Googlebot, follow these href links in the source code, which can lead to inflated crawl budgets and duplicate URL warnings in Google Search Console.
To completely resolve this issue:
1. Block the parameter via robots.txt (Highly Recommended)
The quickest and most reliable way to prevent search engines from crawling these links is to disallow the parameter globally. Please contact your hosting provider for assistance with this. Add the following rule to your site’s robots.txt file:
Disallow: /*add-to-cart=*
Note: If you are also using custom layout parameters mentioned in the thread (such as view_mode or et_columns-count), you should add them to the block list as well:
Disallow: /*view_mode=*
Disallow: /*view_mode_smart=*
Disallow: /*et_columns-count=*
2. Add rel=”nofollow” to WooCommerce loop buttons via PHP
To ensure crawlers do not pass any link juice or follow the shop loop buttons, you can inject a nofollow attribute. Add this snippet to your child-theme/functions.php file or via a code snippets plugin:
add_filter( 'woocommerce_loop_add_to_cart_link', 'custom_add_nofollow_to_loop_cart_button', 10, 3 );
function custom_add_nofollow_to_loop_cart_button( $html, $product, $args ) {
if ( strpos( $html, 'rel=' ) === false ) {
$html = str_replace( 'class=', 'rel="nofollow" class=', $html );
} elseif ( strpos( $html, 'nofollow' ) === false ) {
$html = str_replace( 'rel="', 'rel="nofollow ', $html );
}
return $html;
}
Once these changes are applied, Google will gradually remove these URLs from the crawl reports over the next few indexing cycles.
Best Regards,
Jack Richardson
The 8Theme’s Team















