Forzar el orden aleatorio.

add_filter('woocommerce_get_catalog_ordering_args', 'orden_por_defecto_random');
function orden_por_defecto_random($args) {
    if( is_shop() && ( ! isset($_GET['orderby']) || 'menu_order' === $_GET['orderby'] ) ) {
        $args['orderby'] = 'rand';
        return ($args);
    }
}

Dar la opción al usuario de ordenar los productos.

add_filter( 'woocommerce_get_catalog_ordering_args', 'ordenar_productos_aleatoriamente_con_selector' );
 
function ordenar_productos_aleatoriamente_con_selector( $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'] = 'Aleatoriamente';
return $sortby;
}

Herramientas