Last active
January 18, 2016 08:13
-
-
Save zverush/079e7d64941fe39161c1 to your computer and use it in GitHub Desktop.
WooCommerce - Change default catalog sort order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://gist.github.com/mikejolley/1622323 | |
add_filter('woocommerce_get_catalog_ordering_args', 'am_woocommerce_catalog_orderby'); | |
function am_woocommerce_catalog_orderby( $args ) { | |
$args['meta_key'] = '_price'; | |
$args['orderby'] = 'meta_value_num'; | |
$args['order'] = 'desc'; | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment