Code Duplication    Length = 5-7 lines in 2 locations

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

@@ 1375-1379 (lines=5) @@
1372
		if ( ! $this->order_version || version_compare( $this->order_version, '2.3.7', '<' ) ) {
1373
			// Backwards compatible total calculation - totals were not stored consistently in old versions.
1374
			if ( $ex_tax ) {
1375
				if ( $this->prices_include_tax ) {
1376
					$total_discount = (double) $this->cart_discount - (double) $this->cart_discount_tax;
1377
				} else {
1378
					$total_discount = (double) $this->cart_discount;
1379
				}
1380
			} else {
1381
				if ( $this->prices_include_tax ) {
1382
					$total_discount = (double) $this->cart_discount;
@@ 1380-1386 (lines=7) @@
1377
				} else {
1378
					$total_discount = (double) $this->cart_discount;
1379
				}
1380
			} else {
1381
				if ( $this->prices_include_tax ) {
1382
					$total_discount = (double) $this->cart_discount;
1383
				} else {
1384
					$total_discount = (double) $this->cart_discount + (double) $this->cart_discount_tax;
1385
				}
1386
			}
1387
		// New logic - totals are always stored exclusive of tax, tax total is stored in cart_discount_tax
1388
		} else {
1389
			if ( $ex_tax ) {