Fixing the Resource Hint Domain Bug in WooCommerce 9.9.5+ on Multisite Installations

A Practical Guide for Developers and Administrators**

When managing a WordPress multisite network with multiple domains, it is essential that each subsite loads assets, scripts, and resource hints from its own domain. Unfortunately, recent versions of WooCommerce (9.9.5 and above) introduced a regression in the WooCommerce Blocks system that causes incorrect domain values to appear in wp_resource_hints on multisite installations.

This error results in prefetch and prerender hints referencing the wrong domain. For example, a site running on example.humay output <link rel="preconnect" href="https://example.pl/"> even though every URL setting inside WordPress is correctly configured.

This happens because WooCommerce Blocks caches resource hints in a network-level transient that becomes shared across the entire multisite, even though the contents of these hints should be site-specific.

This guide explains the cause, the symptoms, and—most importantly—how to fix or work around the issue safely.


1. Understanding the Bug

Where the problem originates

Starting from WooCommerce 9.9.5, the file responsible for generating and caching resource hints is:

src/Blocks/AssetsController.php

This controller collects a list of asset URLs and stores them in a transient. Normally, caching such values makes sense for performance—but in a multisite environment, WooCommerce mistakenly stores these hints using a network-wide transient key instead of a site-specific one.

The problematic behavior is tied to a transient named:

woocommerce_block_asset_resource_hints

Because it is stored in the network-level cache rather than per-site, whichever site is the first to generate this transient effectively “poisons” the cache for all other subsites.

The result:
All subsites receive resource hints referencing the domain of the first site that populated the transient.


2. What Symptoms You Will See

Administrators typically notice one or more of the following:

Incorrect prefetch/preconnect hints

On a subsite like example.hu, HTML output may include lines such as:

<link rel="preconnect" href="https://example.pl/" />

Even though:

  • home_url

  • site_url

  • content_url

  • plugins_url

are all configured correctly per site.

See also  Understanding WooCommerce Hosting: A Comprehensive Guide

Asset prefetches pointing to the wrong domain

Prefetch URLs for block assets, fonts, or script endpoints may reference the domain of another subsite.

Caching plugins making the issue worse

Because resource hints are output early in the HTML, full page caching can preserve the wrong hints indefinitely.

Inconsistent behavior

If you clear all transients, each site might temporarily generate correct hints—until one site regenerates the network-level transient again, affecting all others.


3. Why This Happens: The Root Cause

Network transients are shared

In WordPress multisite:

  • set_site_transient()

  • get_site_transient()

store and retrieve values from a single, shared table used across the entire network.

WooCommerce Blocks incorrectly uses one of these network-wide functions (or a wrapper resolving to it) to store asset-related hints that should be local to each subsite.

Resource hints contain absolute URLs

Because the hints include:

  • Script paths

  • Font paths

  • REST endpoints

  • Preconnect/prefetch URLs

…each hint is domain-specific. Storing them centrally is therefore a design flaw.

The first site to warm the cache determines the wrong domain

As soon as a transient is created on one domain, all other sites inherit the cached values—even if the URLs inside are invalid for those subsites.

This explains why the issue appears inconsistently depending on the order of requests.


4. How to Fix or Work Around the Problem

There are several safe approaches you can apply immediately while waiting for an official correction in WooCommerce.


Solution 1: Force WooCommerce to cache hints per-site

You can override the transient key by hooking into the system and generating a site-specific suffix. For example:

  • Include the site ID

  • Include the domain

  • Include a hash of home_url()

This ensures each site has its own cached version of resource hints and does not reuse another site’s data.

See also  Can-Am Spyder iPhone Mount: The Ultimate Guide to Secure and Convenient Phone Mounting

A common approach (described below in pseudocode-style explanation):

  1. Hook into the filter responsible for retrieving the resource hints.

  2. Replace the transient key with a site-specific variant.

  3. Recreate the hint list if the per-site transient does not exist.

  4. Prevent WooCommerce from using the shared network-level transient.

This is the most robust long-term workaround because it preserves the performance benefit of caching.


Solution 2: Disable caching of resource hints entirely

If you prefer simplicity, you can prevent WooCommerce from setting or reading the transient.

The logic:

  • Whenever WooCommerce attempts to retrieve the transient, return an empty value.

  • Force it to regenerate hints on every request.

Side effects:

  • Slightly higher CPU cost when generating resource hints.

  • But on most sites the impact is negligible because the hints list is small.

This is a good option if you simply need correct output now and don’t want to manage custom caching logic.


Solution 3: Flush the network-level transient during theme or plugin load

You can programmatically clear the incorrect transient on every page load or on a regular interval.

However, this is the least recommended long-term approach because:

  • The transient will keep regenerating incorrectly.

  • Clearing the cache repeatedly may degrade performance.

  • It does not fix the underlying issue.

Use this only as a temporary measure.


Solution 4: Override or patch the WooCommerce Blocks AssetsController

For development teams comfortable maintaining custom patches, you can override or adjust the AssetsController so that:

  • It uses get_transient() instead of get_site_transient(),

  • Or generates a unique key per site.

This is the cleanest fix technically, but it requires maintaining a patch that may need to be re-applied after WooCommerce updates.


5. Best Practice Recommendations

Use a site-specific transient key whenever possible

This ensures:

  • Correct URLs per domain

  • No cross-site leakage

  • Efficient local caching

See also  Does Stripe Automatically Pay WooCommerce and Printify?

Regenerate resource hints after switching domains or cloning sites

If you clone a site or change the domain of one subsite:

  • Clear all transients

  • Regenerate hints

  • Refresh caches

Avoid full-page caching until the fix is applied

If your server uses aggressive caching, incorrect hints might persist long after the underlying transient is updated.

Monitor the output of wp_head

Use debugging tools or simple HTML inspection to ensure:

  • The correct domain appears in <link rel="preconnect">

  • No unexpected URLs appear in wp_resource_hints

Plan for WooCommerce updates

Because this is a clear design flaw caused by multisite-unaware caching, a future update of WooCommerce Blocks will likely adjust this logic. Until then, keep an eye on changelogs and test updates on staging sites.


6. Summary

The resource hint bug in WooCommerce 9.9.5 and later versions affects multisite installations using multiple domains. Due to a network-level transient (woocommerce_block_asset_resource_hints) being shared among subsites, the first site that generates resource hints effectively dictates the domain used by all other subsites.

The issue is not caused by misconfiguration.
It is a caching logic flaw within the WooCommerce Blocks AssetsController.

Fortunately, the problem can be mitigated in several reliable ways:

  • Forcing per-site transient keys

  • Disabling or bypassing the transient

  • Clearing the network-level transient

  • Applying a code-level override to adjust caching behavior

Once one of these solutions is implemented, each subsite will correctly output resource hints matching its own domain, eliminating incorrect preconnect and prefetch URLs and restoring expected behavior across the multisite network.