Code Duplication    Length = 6-6 lines in 2 locations

includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php 2 locations

@@ 108-113 (lines=6) @@
105
					$product_ids = $coupon->get_product_ids();
106
					$json_ids    = array();
107
108
					foreach ( $product_ids as $product_id ) {
109
						$product = wc_get_product( $product_id );
110
						if ( is_object( $product ) ) {
111
							$json_ids[ $product_id ] = wp_kses_post( $product->get_formatted_name() );
112
						}
113
					}
114
115
					echo esc_attr( json_encode( $json_ids ) );
116
					?>" value="<?php echo implode( ',', array_keys( $json_ids ) ); ?>" /> <?php echo wc_help_tip( __( 'Products which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce' ) ); ?></p>
@@ 126-131 (lines=6) @@
123
					$product_ids = $coupon->get_excluded_product_ids();
124
					$json_ids    = array();
125
126
					foreach ( $product_ids as $product_id ) {
127
						$product = wc_get_product( $product_id );
128
						if ( is_object( $product ) ) {
129
							$json_ids[ $product_id ] = wp_kses_post( $product->get_formatted_name() );
130
						}
131
					}
132
133
					echo esc_attr( json_encode( $json_ids ) );
134
				?>" value="<?php echo implode( ',', array_keys( $json_ids ) ); ?>" /> <?php echo wc_help_tip( __( 'Products which must not be in the cart to use this coupon or, for "Product Discounts", which products are not discounted.', 'woocommerce' ) ); ?></p>