Code Duplication    Length = 3-5 lines in 2 locations

includes/admin/meta-boxes/views/html-product-attribute.php 1 location

@@ 38-40 (lines=3) @@
35
									);
36
									$all_terms = get_terms( $taxonomy, apply_filters( 'woocommerce_product_attribute_terms', $args ) );
37
									if ( $all_terms ) {
38
										foreach ( $all_terms as $term ) {
39
											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>';
40
										}
41
									}
42
									?>
43
								</select>

includes/wc-template-functions.php 1 location

@@ 2155-2159 (lines=5) @@
2152
				// Get terms if this is a taxonomy - ordered. We need the names too.
2153
				$terms = wc_get_product_terms( $product->id, $attribute, array( 'fields' => 'all' ) );
2154
2155
				foreach ( $terms as $term ) {
2156
					if ( in_array( $term->slug, $options ) ) {
2157
						$html .= '<option value="' . esc_attr( $term->slug ) . '" ' . selected( sanitize_title( $args['selected'] ), $term->slug, false ) . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) ) . '</option>';
2158
					}
2159
				}
2160
			} else {
2161
				foreach ( $options as $option ) {
2162
					// This handles < 2.4.0 bw compatibility where text attributes were not sanitized.