Code Duplication    Length = 3-3 lines in 4 locations

includes/class-wc-shipping.php 1 location

@@ 297-299 (lines=3) @@
294
					$this->shipping_total += $rate->cost;
295
296
					if ( ! empty( $rate->taxes ) && is_array( $rate->taxes ) ) {
297
						foreach ( array_keys( $this->shipping_taxes + $rate->taxes ) as $key ) {
298
							$this->shipping_taxes[ $key ] = ( isset( $rate->taxes[$key] ) ? $rate->taxes[$key] : 0 ) + ( isset( $this->shipping_taxes[$key] ) ? $this->shipping_taxes[$key] : 0 );
299
						}
300
					}
301
				}
302
			}

includes/class-wc-cart.php 3 locations

@@ 1329-1331 (lines=3) @@
1326
					}
1327
1328
					// Tax rows - merge the totals we just got
1329
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1330
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1331
					}
1332
1333
				/**
1334
				 * Prices exclude tax.
@@ 1355-1357 (lines=3) @@
1352
					$line_total            = $discounted_price * $values['quantity'];
1353
1354
					// Tax rows - merge the totals we just got
1355
					foreach ( array_keys( $this->taxes + $discounted_taxes ) as $key ) {
1356
						$this->taxes[ $key ] = ( isset( $discounted_taxes[ $key ] ) ? $discounted_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
1357
					}
1358
				}
1359
1360
				// Cart contents total is based on discounted prices and is used for the final total calculation
@@ 2021-2023 (lines=3) @@
2018
							$this->fees[ $fee_key ]->tax_data = $fee_taxes;
2019
2020
							// Tax rows - merge the totals we just got
2021
							foreach ( array_keys( $this->taxes + $fee_taxes ) as $key ) {
2022
								$this->taxes[ $key ] = ( isset( $fee_taxes[ $key ] ) ? $fee_taxes[ $key ] : 0 ) + ( isset( $this->taxes[ $key ] ) ? $this->taxes[ $key ] : 0 );
2023
							}
2024
						}
2025
					}
2026
				}