Reply 330683 to: Display Random Products in Related Products

Avatar: Rose Tyler
Rose Tyler
Support staff
July 29, 2022 at 13:07

Hello,

Please note that we are not responsible for custom changes that you do in the child theme.

1/ your admin access is out of working state
2/ the code we sent you above is different from the one you sent in last topic. Do you want to show them in rand order or sorted by title because there is only one param that could show either by title or by rand ?

our code:

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

your code:

add_filter(‘woocommerce_related_products_args’, function($args) {
$args[‘orderby’] = ‘title’;
$args[‘order’] = ‘ASC’;
return $args;
}, 9999);

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.