x Sorry, these patches are not available anymore due to data migration. Please run a fresh inspection.

Code Duplication    Length = 5-5 lines in 2 locations

includes/wc-product-functions.php 1 location

@@ 610-614 (lines=5) @@
607
	}
608
609
	// Update price if on sale
610
	if ( '' !== $sale_price && '' === $date_to && '' === $date_from ) {
611
		update_post_meta( $product_id, '_price', $sale_price );
612
	} else {
613
		update_post_meta( $product_id, '_price', $regular_price );
614
	}
615
616
	if ( '' !== $sale_price && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
617
		update_post_meta( $product_id, '_price', $sale_price );

includes/admin/meta-boxes/class-wc-meta-box-product-data.php 1 location

@@ 1422-1426 (lines=5) @@
1419
				}
1420
1421
				// Update price if on sale
1422
				if ( '' !== $sale_price && '' === $date_to && '' === $date_from ) {
1423
					update_post_meta( $variation_id, '_price', $sale_price );
1424
				} else {
1425
					update_post_meta( $variation_id, '_price', $regular_price );
1426
				}
1427
1428
				if ( '' !== $sale_price && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
1429
					update_post_meta( $variation_id, '_price', $sale_price );