Code Duplication    Length = 3-3 lines in 4 locations

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

@@ 1014-1016 (lines=3) @@
1011
			// Update price if on sale
1012
			if ( '' !== $sale_price && '' === $date_to && '' === $date_from ) {
1013
				update_post_meta( $post_id, '_price', wc_format_decimal( $sale_price ) );
1014
			} elseif ( '' !== $sale_price && $date_from && strtotime( $date_from ) <= strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
1015
				update_post_meta( $post_id, '_price', wc_format_decimal( $sale_price ) );
1016
			} else {
1017
				update_post_meta( $post_id, '_price', '' === $regular_price ? '' : wc_format_decimal( $regular_price ) );
1018
			}
1019
@@ 1419-1421 (lines=3) @@
1416
					update_post_meta( $variation_id, '_price', $regular_price );
1417
				}
1418
1419
				if ( '' !== $sale_price && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
1420
					update_post_meta( $variation_id, '_price', $sale_price );
1421
				}
1422
1423
				if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
1424
					update_post_meta( $variation_id, '_price', $regular_price );

includes/cli/class-wc-cli-product.php 1 location

@@ 1282-1284 (lines=3) @@
1279
				update_post_meta( $product_id, '_price', $regular_price );
1280
			}
1281
1282
			if ( '' !== $sale_price && $date_from && $date_from <= strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
1283
				update_post_meta( $product_id, '_price', wc_format_decimal( $sale_price ) );
1284
			}
1285
1286
			if ( $date_to && $date_to < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
1287
				update_post_meta( $product_id, '_price', $regular_price );

includes/wc-product-functions.php 1 location

@@ 621-623 (lines=3) @@
618
		update_post_meta( $product_id, '_price', $regular_price );
619
	}
620
621
	if ( '' !== $sale_price && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
622
		update_post_meta( $product_id, '_price', $sale_price );
623
	}
624
625
	if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
626
		update_post_meta( $product_id, '_price', $regular_price );