Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #20633

    Anyway to change the order or default ordering for products on a category page, i.e. instead of alphabetical have it go by price?

    #108402

    I didn’t test the code but based on the code from: http://wcdocs.woothemes.com/snippets/custom-sorting-options-ascdesc/ I’d say you can change the order with:

    /**
    * This code should be added to functions.php of your theme
    **/
    add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args');

    function custom_woocommerce_get_catalog_ordering_args( $args ) {
    $args['orderby'] = 'meta_value_num';
    $args['order'] = 'desc';
    $args['meta_key'] = '_price';
    return $args;
    }

    add the code to the very bottom of functions.php. You can also replace desc with asc for an ascending order.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Order of products on category page?’ is closed to new replies.