Randomize WooCommerce Related Products
The following code will allow you to randomize the WooCommerce Related Products, if such functionality is desired:
/*
* Randomize Related products
*/
add_filter( 'woocommerce_output_related_products_args', 'kallyasChild_randomizeRelatedProducts', 9000 );
function kallyasChild_randomizeRelatedProducts( $args ){
if(! is_array($args)){
// Set defaults if empty
$args = array(
'posts_per_page' => 4,
'columns' => 4,
);
}
$args['orderby'] = 'rand';
return $args;
}