Fix tax recalc

This commit is contained in:
Mike Jolley 2017-08-10 16:22:17 +01:00
parent 22d6c789ab
commit 30c80c6ad5
1 changed files with 2 additions and 4 deletions

View File

@ -1271,14 +1271,12 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
}
// Trigger tax recalculation for all items.
foreach ( $this->get_items( array( 'line_item', 'fee', 'discount' ) ) as $item_id => $item ) {
foreach ( $this->get_items( array( 'line_item', 'fee', 'discount' ) ) as $item_id => &$item ) {
$item->calculate_taxes( $calculate_tax_for );
$item->save();
}
foreach ( $this->get_shipping_methods() as $item_id => $item ) {
foreach ( $this->get_shipping_methods() as $item_id => &$item ) {
$item->calculate_taxes( array_merge( $calculate_tax_for, array( 'tax_class' => $shipping_tax_class ) ) );
$item->save();
}
$this->update_taxes();