Commit b411a45c883 for woocommerce

commit b411a45c88303b5ce3aeefe20c34536de3f5c88b
Author: Dilip Raghavan <48573621+dilipraghavan@users.noreply.github.com>
Date:   Tue May 5 10:54:41 2026 -0600

    Fix: use home_url() instead of get_site_url() for transient file public URL

    * Fix: use home_url() instead of get_site_url() for transient file public URL

    * Add changelog entry for fix #64242

    * Update test mock from get_site_url to home_url in test_get_public_url

    * Improve transient file URL regression test

    * Fix transient file URL changelog format

    * Fix transient file changelog header

    ---------

    Co-authored-by: Brandon Kraft <public@brandonkraft.com>

diff --git a/plugins/woocommerce/changelog/64242-fix-transient-file-url-uses-home-url b/plugins/woocommerce/changelog/64242-fix-transient-file-url-uses-home-url
new file mode 100644
index 00000000000..69c3f047878
--- /dev/null
+++ b/plugins/woocommerce/changelog/64242-fix-transient-file-url-uses-home-url
@@ -0,0 +1,3 @@
+Significance: patch
+Type: fix
+Comment: Fix transient file public URL to use home_url() instead of get_site_url(), resolving 404s on subdirectory WordPress installs
diff --git a/plugins/woocommerce/src/Internal/TransientFiles/TransientFilesEngine.php b/plugins/woocommerce/src/Internal/TransientFiles/TransientFilesEngine.php
index 2a7a254976d..b62b82c1b58 100644
--- a/plugins/woocommerce/src/Internal/TransientFiles/TransientFilesEngine.php
+++ b/plugins/woocommerce/src/Internal/TransientFiles/TransientFilesEngine.php
@@ -219,7 +219,7 @@ class TransientFilesEngine implements RegisterHooksInterface {
 	 * @return string The public URL of the file.
 	 */
 	public function get_public_url( string $filename ) {
-		return $this->legacy_proxy->call_function( 'get_site_url', null, '/wc/file/transient/' . $filename );
+		return $this->legacy_proxy->call_function( 'home_url', '/wc/file/transient/' . $filename );
 	}

 	/**
diff --git a/plugins/woocommerce/tests/php/src/Internal/TransientFiles/TransientFilesEngineTest.php b/plugins/woocommerce/tests/php/src/Internal/TransientFiles/TransientFilesEngineTest.php
index b3869c2df83..1e770bdeda4 100644
--- a/plugins/woocommerce/tests/php/src/Internal/TransientFiles/TransientFilesEngineTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/TransientFiles/TransientFilesEngineTest.php
@@ -348,12 +348,13 @@ class TransientFilesEngineTest extends \WC_REST_Unit_Test_Case {
 	}

 	/**
-	 * @testdox get_public_url returns the full public URL of a transient file given its name.
+	 * @testdox get_public_url uses the frontend URL for subdirectory WordPress installs.
 	 */
 	public function test_get_public_url() {
 		$this->register_legacy_proxy_function_mocks(
 			array(
-				'get_site_url' => fn( $blog_id, $path) => 'http://example.com' . $path,
+				'home_url'     => fn( $path = '' ) => 'http://example.com' . $path,
+				'get_site_url' => fn( $blog_id = null, $path = '' ) => 'http://example.com/wp' . $path,
 			)
 		);