| @@ 308-310 (lines=3) @@ | ||
| 305 | $item_taxes = WC_Tax::calc_shipping_tax( $amount, WC_Tax::get_shipping_tax_rates( $cart[ $cost_key ]['data']->get_tax_class() ) ); |
|
| 306 | ||
| 307 | // Sum the item taxes |
|
| 308 | foreach ( array_keys( $taxes + $item_taxes ) as $key ) { |
|
| 309 | $taxes[ $key ] = ( isset( $item_taxes[ $key ] ) ? $item_taxes[ $key ] : 0 ) + ( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 ); |
|
| 310 | } |
|
| 311 | } |
|
| 312 | ||
| 313 | // Add any cost for the order - order costs are in the key 'order' |
|
| @@ 318-320 (lines=3) @@ | ||
| 315 | $item_taxes = WC_Tax::calc_shipping_tax( $costs['order'], WC_Tax::get_shipping_tax_rates() ); |
|
| 316 | ||
| 317 | // Sum the item taxes |
|
| 318 | foreach ( array_keys( $taxes + $item_taxes ) as $key ) { |
|
| 319 | $taxes[ $key ] = ( isset( $item_taxes[ $key ] ) ? $item_taxes[ $key ] : 0 ) + ( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 ); |
|
| 320 | } |
|
| 321 | } |
|
| 322 | } |
|
| 323 | ||
| @@ 728-730 (lines=3) @@ | ||
| 725 | wc_update_order_item_meta( $item_id, '_line_tax_data', array( 'total' => $line_taxes, 'subtotal' => $line_subtotal_taxes ) ); |
|
| 726 | ||
| 727 | // Sum the item taxes |
|
| 728 | foreach ( array_keys( $taxes + $line_taxes ) as $key ) { |
|
| 729 | $taxes[ $key ] = ( isset( $line_taxes[ $key ] ) ? $line_taxes[ $key ] : 0 ) + ( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 ); |
|
| 730 | } |
|
| 731 | } |
|
| 732 | } |
|
| 733 | ||
| @@ 773-775 (lines=3) @@ | ||
| 770 | wc_update_order_item_meta( $item_id, '_line_tax_data', array( 'total' => $line_taxes ) ); |
|
| 771 | ||
| 772 | // Sum the item taxes |
|
| 773 | foreach ( array_keys( $shipping_taxes + $line_taxes ) as $key ) { |
|
| 774 | $shipping_taxes[ $key ] = ( isset( $line_taxes[ $key ] ) ? $line_taxes[ $key ] : 0 ) + ( isset( $shipping_taxes[ $key ] ) ? $shipping_taxes[ $key ] : 0 ); |
|
| 775 | } |
|
| 776 | } |
|
| 777 | ||
| 778 | // Save tax totals |
|
| @@ 786-788 (lines=3) @@ | ||
| 783 | $this->remove_order_items( 'tax' ); |
|
| 784 | ||
| 785 | // Now merge to keep tax rows |
|
| 786 | foreach ( array_keys( $taxes + $shipping_taxes ) as $tax_rate_id ) { |
|
| 787 | $this->add_tax( $tax_rate_id, isset( $taxes[ $tax_rate_id ] ) ? $taxes[ $tax_rate_id ] : 0, isset( $shipping_taxes[ $tax_rate_id ] ) ? $shipping_taxes[ $tax_rate_id ] : 0 ); |
|
| 788 | } |
|
| 789 | ||
| 790 | return true; |
|
| 791 | } |
|
| @@ 1559-1561 (lines=3) @@ | ||
| 1556 | } |
|
| 1557 | ||
| 1558 | // Sum the item taxes |
|
| 1559 | foreach ( array_keys( $taxes + $line_taxes ) as $key ) { |
|
| 1560 | $taxes[ $key ] = ( isset( $line_taxes[ $key ] ) ? $line_taxes[ $key ] : 0 ) + ( isset( $taxes[ $key ] ) ? $taxes[ $key ] : 0 ); |
|
| 1561 | } |
|
| 1562 | } |
|
| 1563 | } |
|
| 1564 | } |
|