Code Duplication    Length = 7-7 lines in 4 locations

includes/admin/meta-boxes/class-wc-meta-box-product-data.php 4 locations

@@ 348-354 (lines=7) @@
345
		$date_on_sale_to   = '';
346
347
		// Force date from to beginning of day.
348
		if ( isset( $_POST['_sale_price_dates_from'] ) ) {
349
			$date_on_sale_from = wc_clean( wp_unslash( $_POST['_sale_price_dates_from'] ) );
350
351
			if ( ! empty( $date_on_sale_from ) ) {
352
				$date_on_sale_from = date( 'Y-m-d 00:00:00', strtotime( $date_on_sale_from ) );
353
			}
354
		}
355
356
		// Force date to to the end of the day.
357
		if ( isset( $_POST['_sale_price_dates_to'] ) ) {
@@ 357-363 (lines=7) @@
354
		}
355
356
		// Force date to to the end of the day.
357
		if ( isset( $_POST['_sale_price_dates_to'] ) ) {
358
			$date_on_sale_to = wc_clean( wp_unslash( $_POST['_sale_price_dates_to'] ) );
359
360
			if ( ! empty( $date_on_sale_to ) ) {
361
				$date_on_sale_to = date( 'Y-m-d 23:59:59', strtotime( $date_on_sale_to ) );
362
			}
363
		}
364
365
		$errors = $product->set_props(
366
			array(
@@ 474-480 (lines=7) @@
471
				$date_on_sale_to   = '';
472
473
				// Force date from to beginning of day.
474
				if ( isset( $_POST['variable_sale_price_dates_from'][ $i ] ) ) {
475
					$date_on_sale_from = wc_clean( wp_unslash( $_POST['variable_sale_price_dates_from'][ $i ] ) );
476
477
					if ( ! empty( $date_on_sale_from ) ) {
478
						$date_on_sale_from = date( 'Y-m-d 00:00:00', strtotime( $date_on_sale_from ) );
479
					}
480
				}
481
482
				// Force date to to the end of the day.
483
				if ( isset( $_POST['variable_sale_price_dates_to'][ $i ] ) ) {
@@ 483-489 (lines=7) @@
480
				}
481
482
				// Force date to to the end of the day.
483
				if ( isset( $_POST['variable_sale_price_dates_to'][ $i ] ) ) {
484
					$date_on_sale_to = wc_clean( wp_unslash( $_POST['variable_sale_price_dates_to'][ $i ] ) );
485
486
					if ( ! empty( $date_on_sale_to ) ) {
487
						$date_on_sale_to = date( 'Y-m-d 23:59:59', strtotime( $date_on_sale_to ) );
488
					}
489
				}
490
491
				$errors = $variation->set_props(
492
					array(