Allow disabling of shuffling related posts via `woocommerce_product_related_posts_shuffle` filter. #23558
This filter ensures backwards compatibility is maintained.
This commit is contained in:
parent
563b84ece4
commit
70064b5eb1
|
@ -886,7 +886,9 @@ function wc_get_related_products( $product_id, $limit = 5, $exclude_ids = array(
|
|||
)
|
||||
);
|
||||
|
||||
shuffle( $related_posts );
|
||||
if ( apply_filters( 'woocommerce_product_related_posts_shuffle', true ) ) {
|
||||
shuffle( $related_posts );
|
||||
}
|
||||
|
||||
return array_slice( $related_posts, 0, $limit );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue