Add filters for attribute selection UI

This commit is contained in:
Teemu Suoranta 2016-06-05 21:22:10 +03:00
parent fa0422a7f0
commit 35519fb685
1 changed files with 6 additions and 2 deletions

View File

@ -29,10 +29,14 @@
<select multiple="multiple" data-placeholder="<?php esc_attr_e( 'Select terms', 'woocommerce' ); ?>" class="multiselect attribute_values wc-enhanced-select" name="attribute_values[<?php echo $i; ?>][]">
<?php
$all_terms = get_terms( $taxonomy, 'orderby=name&hide_empty=0' );
$args = array(
'orderby' => 'name',
'hide_empty' => 0
);
$all_terms = get_terms( $taxonomy, apply_filters( 'woocommerce_product_attribute_terms', $args ) );
if ( $all_terms ) {
foreach ( $all_terms as $term ) {
echo '<option value="' . esc_attr( $term->slug ) . '" ' . selected( has_term( absint( $term->term_id ), $taxonomy, $thepostid ), true, false ) . '>' . $term->name . '</option>';
echo '<option value="' . esc_attr( $term->slug ) . '" ' . selected( has_term( absint( $term->term_id ), $taxonomy, $thepostid ), true, false ) . '>' . esc_attr( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
}
}
?>