diff --git a/src/commonfunctions.php b/src/commonfunctions.php index 2889502a..4e8ab110 100755 --- a/src/commonfunctions.php +++ b/src/commonfunctions.php @@ -1882,11 +1882,11 @@ public function getCartShipping() { $shipping_tax = $cart_shipping_tax; } - if ($order_shipping_tax > 0 AND is_object(WC()->cart) == true AND method_exists(WC()->cart, 'get_cart_item_tax_classes') == true) { + if (is_object(WC()->cart) == true AND method_exists(WC()->cart, 'get_cart_item_tax_classes') == true) { // Get shipping tax rate from cart $rates = current(WC_Tax::get_shipping_tax_rates()); if (is_array($rates) AND isset($rates['rate'])) { - $taxzrate = round($rates['rate']); + $taxrate = round($rates['rate']); } } } else { @@ -1907,6 +1907,9 @@ public function getCartShipping() { $taxrate = ($shipping_tax / $shipping_total) * 100; } } + if ($shipping_tax == 0 && $taxrate > 0){ + $shipping_tax = $shipping_total*(1+($taxrate/100))-$shipping_total; + } return array( "price" => round($shipping_total * 100),