Тут довольно просто - в коде используется 'random_list', тип сортировки для которого 'rand'
Изменяем это на необходимые нам - например для сортировки по алфавиту стоит поставить тип сортировки 'name'
Там же приведена ссылка на
http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
В котором приведены различные варианты для сортировки
- 'ID' - Order by post id. Note the capitalization.
- 'author' - Order by author.
- 'title' - Order by title.
- 'name' - Order by post name (post slug).
- 'modified' - Order by last modified date.
- 'parent' - Order by post/page parent id.
- 'comment_count' - Order by number of comments (available with Version 2.9).
- 'menu_order' - Order by Page Order. Used most often for Pages (Order field in the Edit Page Attributes box) and forAttachments (the integer fields in the Insert / Upload Media Gallery dialog), but could be used for any post type with distinct 'menu_order' values (they all default to 0).
- 'meta_value' - Note that a 'meta_key=keyname' must also be present in the query. Note also that the sorting will be alphabetical which is fine for strings (i.e. words), but can be unexpected for numbers (e.g. 1, 3, 34, 4, 56, 6, etc, rather than 1, 3, 4, 6, 34, 56 as you might naturally expect). Use 'meta_value_num' instead for numeric values.
- 'meta_value_num' - Order by numeric meta value (available with Version 2.8). Also note that a 'meta_key=keyname' must also be present in the query. This value allows for numerical sorting as noted above in 'meta_value'.
- 'post__in' - Preserve post ID order given in the post__in array (available with Version 3.5).
Таким образом на выходе для сортировки по имени товара получаем
<?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 ( 'name_list' == $orderby_value ) {
$args['orderby'] = 'name';
$args['order'] = 'ASC'; (или 'DESC'

$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['name_list'] = 'Сортировать по имени';
return $sortby;
}