No need for default sorting

This commit is contained in:
Mike Jolley 2019-01-25 19:56:12 +00:00
parent a38add7ac8
commit 05ab331ea8
1 changed files with 1 additions and 19 deletions

View File

@ -2760,25 +2760,7 @@ class WC_API_Products extends WC_API_Resource {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_attribute_id', __( 'A product attribute with the provided ID could not be found', 'woocommerce' ), 404 ); throw new WC_API_Exception( 'woocommerce_api_invalid_product_attribute_id', __( 'A product attribute with the provided ID could not be found', 'woocommerce' ), 404 );
} }
$args = array( 'hide_empty' => false ); $terms = get_terms( $taxonomy, array( 'hide_empty' => false ) );
$orderby = wc_attribute_orderby( $taxonomy );
switch ( $orderby ) {
case 'name' :
$args['orderby'] = 'name';
$args['menu_order'] = false;
break;
case 'id' :
$args['orderby'] = 'id';
$args['order'] = 'ASC';
$args['menu_order'] = false;
break;
case 'menu_order' :
$args['menu_order'] = 'ASC';
break;
}
$terms = get_terms( $taxonomy, $args );
$attribute_terms = array(); $attribute_terms = array();
foreach ( $terms as $term ) { foreach ( $terms as $term ) {