How to Disable the Related Products Shuffle in WooCommerce

How to Disable the Related Products Shuffle in WooCommerce
On this page
  1. Why Show the Same Related Products Every Time
  2. Step 1: Disable the Shuffle
  3. Troubleshooting
  4. Frequently Asked Questions
  5. Conclusion

You can disable the related products shuffle in WooCommerce with two filters — one to stop the random selection from a larger pool, and one to stop the random sort order — so the same set of related products always appears in the same order.

  • WooCommerce calculates up to 15-ish candidate related products, shuffles them, then shows a random subset (default 4) in random order on every page load
  • A consistent set makes it easier to feature specific cross-sell products deliberately rather than leaving it to chance
  • Predictable output is easier to test and screenshot for marketing or documentation purposes

Step 1: Disable the Shuffle

PHP
/** Stop WooCommerce from shuffling the pool of related products before display */
add_filter( 'woocommerce_product_related_posts_shuffle', '__return_false' );

Step 2: Disable Random Sorting of the Displayed Set

PHP
/** Sort the displayed related products by title instead of randomly */
add_filter( 'woocommerce_output_related_products_args', 'sort_related_products_consistently' );

function sort_related_products_consistently( $args ) {
    $args['orderby'] = 'title';
    $args['order']   = 'ASC';
    return $args;
}

Both filters are needed together: the first stops WooCommerce from randomly picking which candidates make the final cut, and the second stops the final set from displaying in random order.

Troubleshooting

Related Products Still Change Between Page Loads

Confirm both filters are active — using only one of the two still leaves some randomness in either the selection or the ordering stage.

Fewer Related Products Show After This Change

This shouldn’t happen from these filters alone — if the count drops, check whether a caching layer is serving a stale, smaller result set from before the change was applied.

Frequently Asked Questions

Can I sort by something other than title?

Yes, WooCommerce’s standard orderby values apply here too — use date, price, or menu_order depending on how you want the set arranged.

Does this guarantee the exact same products forever?

As long as the underlying category/tag relationships between products don’t change, yes — the selection pool itself is still based on shared categories and tags.

Will this affect upsells too?

No, upsells are manually curated per product and aren’t subject to the same shuffle logic as related products.

Conclusion

Disabling the related products shuffle in WooCommerce takes two filters working together — one for selection, one for sort order. Combined, they turn WooCommerce’s randomized related products section into a consistent, predictable one.

See also How to Disable Related Products on a Per-Product Basis.

Prefer no code? All-in-One Utilities Woo Add-on handles this kind of change from a settings screen. Its Reviews and related products guide also shows how.

Leave a Reply

Schedule a call