Commit 375a1ff509 for woocommerce
commit 375a1ff509f105a0510ca8829f88745347e168f1
Author: Joshua T Flowers <joshuatf@gmail.com>
Date: Tue Sep 16 09:18:08 2025 -0400
Add add-to-cart paths to robots.txt file (#60899)
* Add add-to-cart paths to robots.txt file
* Add changelog entry
* Disallow add to cart in any parameter order
diff --git a/plugins/woocommerce/changelog/update-60810 b/plugins/woocommerce/changelog/update-60810
new file mode 100644
index 0000000000..209cc1e03b
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-60810
@@ -0,0 +1,4 @@
+Significance: patch
+Type: update
+
+Add add-to-cart paths to robots.txt file
diff --git a/plugins/woocommerce/includes/class-woocommerce.php b/plugins/woocommerce/includes/class-woocommerce.php
index 557aeb8cc6..3b9bd4e356 100644
--- a/plugins/woocommerce/includes/class-woocommerce.php
+++ b/plugins/woocommerce/includes/class-woocommerce.php
@@ -1130,6 +1130,8 @@ final class WooCommerce {
$above[] = "Disallow: $path/wp-content/uploads/wc-logs/";
$above[] = "Disallow: $path/wp-content/uploads/woocommerce_transient_files/";
$above[] = "Disallow: $path/wp-content/uploads/woocommerce_uploads/";
+ $above[] = 'Disallow: /*?add-to-cart=';
+ $above[] = 'Disallow: /*?*add-to-cart=';
$lines = array_merge( $above, $below );