Code Duplication    Length = 5-7 lines in 2 locations

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

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