Code Duplication    Length = 5-7 lines in 2 locations

includes/abstracts/abstract-wc-order.php 2 locations

@@ 1467-1471 (lines=5) @@
1464
		if ( ! $this->order_version || version_compare( $this->order_version, '2.3.7', '<' ) ) {
1465
			// Backwards compatible total calculation - totals were not stored consistently in old versions.
1466
			if ( $ex_tax ) {
1467
				if ( $this->prices_include_tax ) {
1468
					$total_discount = (double) $this->cart_discount - (double) $this->cart_discount_tax;
1469
				} else {
1470
					$total_discount = (double) $this->cart_discount;
1471
				}
1472
			} else {
1473
				if ( $this->prices_include_tax ) {
1474
					$total_discount = (double) $this->cart_discount;
@@ 1472-1478 (lines=7) @@
1469
				} else {
1470
					$total_discount = (double) $this->cart_discount;
1471
				}
1472
			} else {
1473
				if ( $this->prices_include_tax ) {
1474
					$total_discount = (double) $this->cart_discount;
1475
				} else {
1476
					$total_discount = (double) $this->cart_discount + (double) $this->cart_discount_tax;
1477
				}
1478
			}
1479
		// New logic - totals are always stored exclusive of tax, tax total is stored in cart_discount_tax
1480
		} else {
1481
			if ( $ex_tax ) {