Skip to content

Commit

Permalink
handle tax removal in order class
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Oct 31, 2017
1 parent 80b16ad commit 7c74e77
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions includes/abstracts/abstract-wc-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -1302,11 +1302,15 @@ public function calculate_taxes( $args = array() ) {

// Trigger tax recalculation for all items.
foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) {
$item->calculate_taxes( $calculate_tax_for, $is_vat_exempt );
if ( ! $is_vat_exempt ) {
$item->calculate_taxes( $calculate_tax_for );
} else {
$item->set_taxes( false );
}
}

foreach ( $this->get_shipping_methods() as $item_id => $item ) {
if ( false !== $shipping_tax_class ) {
if ( false !== $shipping_tax_class && ! $is_vat_exempt ) {
$item->calculate_taxes( array_merge( $calculate_tax_for, array( 'tax_class' => $shipping_tax_class ) ) );
} else {
$item->set_taxes( false );
Expand Down

0 comments on commit 7c74e77

Please sign in to comment.