PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Randomise order of products shown

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hey again Pablo,

I'm experiencing a strange behaviour: When you first visit the shop, all the items are sorted by date old to new. When you go to page 2 or 3, the plugin starts to shuffle and randomising the results. So, they're no longer in any order / truly random which is what I want to have all the time. However: It is showing some of the results from the first page again as well.

I tried to achieve a full randomisation through the php code below. However, the problem still persists that as soons as you go to the next page of filter results (e.g. page 2 of 3), products of page 1 or any other page are shown as well. So it indeed does randomise the results, but it does not exclude those products it had already shown on the other pages. The same happens, when you then move back to page 1 again. It randomises the results and shows half of the products from page 2.

Any ideas on how we can fix this?

Thank you in advance!

 

That's my php:

add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' );

function custom_woocommerce_get_catalog_ordering_args( $args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );

if ( 'random_list' == $orderby_value ) {
$args['orderby'] = 'rand';
$args['order'] = '';
$args['meta_key'] = '';
}
return $args;
}

add_filter( 'woocommerce_default_catalog_orderby_options', 'custom_woocommerce_catalog_orderby' );
add_filter( 'woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby' );

function custom_woocommerce_catalog_orderby( $sortby ) {
$sortby['random_list'] = 'Random';
return $sortby;

Hello

It doesn’t depend on my plugin. Unfortunately, I cannot help you with this. You can disable my plugin and the result will be the same