Commit e91ae94ed16 for woocommerce
commit e91ae94ed16f795d41265aa44a71f64a5d2dd597
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date: Wed Jul 1 11:38:58 2026 +0100
Add referrerPolicy to address autocomplete fetch requests (#62967)
* Add referrerPolicy to address autocomplete fetch requests
Explicitly set referrerPolicy: 'origin-when-cross-origin' on both
search and select fetch requests to ensure the Referer header is
sent even when sites have restrictive referrer policies like
<meta name="referrer" content="no-referrer" />.
This helps with analytics tracking on the address autocomplete proxy.
Fixes #61643
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add changelog entry for referrerPolicy fix
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
diff --git a/plugins/woocommerce/changelog/wooplug-5748-add-referrerpolicy-to-address-autocomplete-request b/plugins/woocommerce/changelog/wooplug-5748-add-referrerpolicy-to-address-autocomplete-request
new file mode 100644
index 00000000000..567d2a6ae70
--- /dev/null
+++ b/plugins/woocommerce/changelog/wooplug-5748-add-referrerpolicy-to-address-autocomplete-request
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Add referrerPolicy to address autocomplete fetch requests to ensure Referer header is sent even with restrictive site policies.
diff --git a/plugins/woocommerce/client/legacy/js/frontend/a8c-address-autocomplete-service.js b/plugins/woocommerce/client/legacy/js/frontend/a8c-address-autocomplete-service.js
index f3dcbc39022..3f2355f529b 100644
--- a/plugins/woocommerce/client/legacy/js/frontend/a8c-address-autocomplete-service.js
+++ b/plugins/woocommerce/client/legacy/js/frontend/a8c-address-autocomplete-service.js
@@ -308,7 +308,8 @@
try {
const startTime = performance.now();
const response = await fetch(
- `${ searchUrl }?${ params.toString() }`
+ `${ searchUrl }?${ params.toString() }`,
+ { referrerPolicy: 'origin-when-cross-origin' }
);
const endTime = performance.now();
requestDurations.push( endTime - startTime );
@@ -402,7 +403,8 @@
} );
const response = await fetch(
- `${ selectUrl }?${ params.toString() }`
+ `${ selectUrl }?${ params.toString() }`,
+ { referrerPolicy: 'origin-when-cross-origin' }
);
let data = await response.json();