Fix: the same set of related products is always displayed
get_related_products_query in the WC_Product_Data_Store_CPT class is querying the suitable products with a "limit" clause, this causes that products down in the table are never picked for display. This commit adds a ORDER BY RAND() to the query so that all products have a chance to get picked.
This commit is contained in:
parent
be907c606d
commit
8095482f69
|
@ -1315,6 +1315,8 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
|
|||
AND p.post_type = 'product'
|
||||
|
||||
",
|
||||
'orderby' => '
|
||||
ORDER BY RAND()',
|
||||
'limits' => '
|
||||
LIMIT ' . absint( $limit ) . '
|
||||
',
|
||||
|
|
Loading…
Reference in New Issue