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

@@ 2075-2079 (lines=5) @@
2072
				// Get terms if this is a taxonomy - ordered. We need the names too.
2073
				$terms = wc_get_product_terms( $product->id, $attribute, array( 'fields' => 'all' ) );
2074
2075
				foreach ( $terms as $term ) {
2076
					if ( in_array( $term->slug, $options ) ) {
2077
						$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>';
2078
					}
2079
				}
2080
			} else {
2081
				foreach ( $options as $option ) {
2082
					// This handles < 2.4.0 bw compatibility where text attributes were not sanitized.