Why Are WooCommerce Related Products Slow to Query?
Why the WooCommerce Related Query Is Expensive
Finding related products isn't a simple lookup — it requires comparing the current product's categories and tags against every other product in the catalog to identify overlaps, then ranking and selecting a suitable subset to display. Unlike a straightforward query filtering by a single indexed value, this comparison-based matching is inherently more computationally expensive, and that cost grows as the total number of products to compare against grows.
Ways to Reduce This Cost
- Manually setting upsells and cross-sells on key, high-traffic products bypasses the automatic calculation entirely for those specific products, since a manually curated list requires no expensive comparison query.
- Object caching can cache the related products result for a given product, so the expensive calculation only runs once rather than on every single page view.
- Reducing the number of related products shown slightly reduces query and rendering cost, though the underlying comparison cost is the bigger factor.
- A dedicated recommendation engine or plugin designed for large catalogs can offer a more efficient (and often more relevant) alternative to core WooCommerce's built-in related-products logic at scale.
Addressing This
- Manually curate upsells/cross-sells for your highest-traffic products where practical.
- Enable object caching so the related-products calculation isn't repeated unnecessarily.
- Consider a dedicated recommendation solution if the catalog is large enough that this remains a genuine bottleneck.
Check whether this is your bottleneck
- Profile one product page on staging with Query Monitor and look for slow queries joining products and their terms. Related products show up as comparisons across categories and tags.
- Compare with and without the section. Hide the related products block on a staging copy and see how much the page's response time changes.
- Consider catalog size. This cost matters mostly for large catalogs. On a few hundred products something else is more likely to be the cause.
Cheaper alternatives
WooCommerce stores related-product results temporarily so they don't have to be rebuilt on every view. If the page is still slow, that stored result may be cleared too often, or not persisting because there is no persistent object cache. Fixing that is cheaper than replacing the feature. Curated upsells on your best-selling products remove the calculation entirely where it matters most, and also tend to be better recommendations than the automatic ones.
Need product page performance optimized for a large catalog? See WordPress speed optimization.