mardi 16 août 2016

woocommerce random products without duplicates

i wonder if there is a way to show random products, distributed over several pages, without having any duplicates?

Right know i have the following code in functions.php:

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['rand'] = 'Random';
return $sortby;
}

the pages are triggered by ajax (infinite scroll). Every time 20 products are loaded (representing the pages).

Is there a way to prevent duplicates from being shown?




Aucun commentaire:

Enregistrer un commentaire