Code Duplication    Length = 5-7 lines in 2 locations

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

@@ 1446-1450 (lines=5) @@
1443
		if ( ! $this->order_version || version_compare( $this->order_version, '2.3.7', '<' ) ) {
1444
			// Backwards compatible total calculation - totals were not stored consistently in old versions.
1445
			if ( $ex_tax ) {
1446
				if ( $this->prices_include_tax ) {
1447
					$total_discount = (double) $this->cart_discount - (double) $this->cart_discount_tax;
1448
				} else {
1449
					$total_discount = (double) $this->cart_discount;
1450
				}
1451
			} else {
1452
				if ( $this->prices_include_tax ) {
1453
					$total_discount = (double) $this->cart_discount;
@@ 1451-1457 (lines=7) @@
1448
				} else {
1449
					$total_discount = (double) $this->cart_discount;
1450
				}
1451
			} else {
1452
				if ( $this->prices_include_tax ) {
1453
					$total_discount = (double) $this->cart_discount;
1454
				} else {
1455
					$total_discount = (double) $this->cart_discount + (double) $this->cart_discount_tax;
1456
				}
1457
			}
1458
		// New logic - totals are always stored exclusive of tax, tax total is stored in cart_discount_tax
1459
		} else {
1460
			if ( $ex_tax ) {