Disable Related Products Transient Deletion in WooCommerce

When running a WooCommerce store on WordPress, performance optimization is key to ensuring a smooth and efficient user experience. One often overlooked performance-related issue arises from how WooCommerce handles related products—specifically, the automatic deletion and regeneration of related products transients. While transients are usually a helpful part of WordPress’s caching strategy, in this case, their frequent deletion can bog down your site. Here’s why you might want to disable this deletion and how doing so can reduce performance issues.
What Are Related Products Transients?
In WooCommerce, “related products” are dynamically generated recommendations shown on product pages. These are meant to enhance user engagement and upsell opportunities. WooCommerce caches these related product queries using transients, a temporary option stored in the WordPress database to reduce redundant queries.
Transients are typically created the first time a product page is loaded and remain in place until they expire or are manually deleted. However, WooCommerce is known to automatically clear these cached entries during specific actions, like saving a product or updating inventory. This triggers a new generation process, which involves complex queries that can be quite resource-intensive, especially for stores with extensive product catalogs.
The Problem With Frequent Deletion
On the surface, regularly clearing and regenerating related product transients might seem like a good idea—it ensures up-to-date recommendations. However, this process can be extremely taxing on your server. Every time a product is updated, WooCommerce purges the transient cache and re-runs the related product queries. For sites with thousands of products, this can cause significant slowdowns and even lead to timeouts or crashes during bulk product updates or imports.
Moreover, since related products don’t typically change that often, regenerating the transient every time something minor changes (like updating the product price) is unnecessary and wasteful.
Benefits of Disabling Related Products Transients Deletion
By disabling the automatic deletion of related products transients, you keep your existing cache intact, significantly reducing the number of database queries and computational load. This can lead to:
- Faster product updates: Reducing backend strain during product imports or bulk edits.
- Improved front-end speed: Since the transient is already cached, product pages load faster.
- Reduced server resource usage: Minimizing unnecessary database and CPU overhead.
- More stable performance: Especially during peak traffic or promotional events.
How to Disable It
You use the code snippets extension from MainWP to save and execute code snippets on all connected sites.
You can use the following code snippet to disable the deletion of related products transients if you don’t use related products on your WooCommerce store.
If you are used to using WP-CLI on the site’s server, you can run the following command.
wp cron event unschedule wc_delete_related_product_transients_asyn
Disabling the deletion of related products transients is a clever performance tweak for medium to large WooCommerce stores. It prevents unnecessary regeneration of related product data, reduces server load, and improves both backend and frontend speeds. While it’s not a universal fix, it’s a low-effort adjustment that can make a significant impact on store performance.
Useful Links
https://wordpress.org/support/topic/disable-hook-wc_delete_related_product_transients_async
Share
Manage Unlimited WordPress Sites from One Dashboard!
- Privacy-first, Open Source, Self-hosted
- Easy Client Management
- 15+ & 30 + Premium Add-ons
- Bulk Plugins & Themes Management