Reply 325041 to: Display Random Products in Related Products

Avatar: Rose Tyler
Rose Tyler
Support staff
June 2, 2022 at 10:52

Hello,

We’ve checked more deeply, Related products are displayed in our theme randomly, by default. But on your site it is not, so check if you did any changes in files that may affect it, for example changes in xstore-child/woocommerce/single-product/related.php, or maybe something from 3rd party plugins affects related products.
You can try to add the next code in functions.php of the child theme:

add_filter('woocommerce_related_products_args', function($args) {
    $args['orderby'] = 'rand';
    return $args;
}, 9999);

If you need any further assistance with this, provide temporary wp-admin and FTP access, so we can take a closer look.

Regards

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.