revised wc_get_product_terms to allow override with args
This commit is contained in:
parent
682e14bdc1
commit
e508a668a3
|
@ -690,7 +690,7 @@ class WC_AJAX {
|
|||
$attribute_field_name = 'attribute_' . sanitize_title( $attribute['name'] );
|
||||
|
||||
if ( $attribute['is_taxonomy'] ) {
|
||||
$options = wc_get_product_terms( $post_id, $attribute['name'], array( 'fields' => 'slugs' ) );
|
||||
$options = wc_get_product_terms( $post_id, $attribute['name'], array( 'fields' => 'names' ) );
|
||||
} else {
|
||||
$options = explode( WC_DELIMITER, $attribute['value'] );
|
||||
}
|
||||
|
|
|
@ -56,11 +56,11 @@ function wc_get_product_terms( $product_id, $taxonomy, $args = array() ) {
|
|||
break;
|
||||
}
|
||||
} elseif ( ! empty( $args['orderby'] ) && $args['orderby'] === 'menu_order' ) {
|
||||
// wp_get_post_terms doens't let us use custom sort order
|
||||
// wp_get_post_terms doesn't let us use custom sort order
|
||||
$args['include'] = wp_get_post_terms( $product_id, $taxonomy, array( 'fields' => 'ids' ) );
|
||||
$args['menu_order'] = isset( $args['order'] ) ? $args['order'] : 'ASC';
|
||||
$args['hide_empty'] = 0;
|
||||
$args['fields'] = 'names';
|
||||
$args['hide_empty'] = isset( $args['hide_empty'] ) ? $args['hide_empty'] : 0;
|
||||
$args['fields'] = isset( $args['fields'] ) ? $args['fields'] : 'names';
|
||||
|
||||
unset( $args['orderby'] );
|
||||
|
||||
|
|
Loading…
Reference in New Issue