Skip to content

Commit

Permalink
No tax should apply Tax basis = Store & store zone has no tax set
Browse files Browse the repository at this point in the history
fixes issue zencart#6384
  • Loading branch information
piloujp committed Apr 11, 2024
1 parent a0135a2 commit d157dde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions includes/classes/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ function determineTaxAddressZones($billToAddressId, $shipToAddressId)
if (isset($this->billing['zone_id']) && $this->billing['zone_id'] == STORE_ZONE) {
$address_book_id = $billToAddressId;
} else {
$address_book_id = ($this->content_type === 'virtual' ? $billToAddressId : $shipToAddressId);
$address_book_id = ($this->content_type === 'virtual' ? $billToAddressId : -1);
}
}
$tax_address_query = "SELECT ab.entry_country_id, ab.entry_zone_id
Expand Down Expand Up @@ -903,8 +903,9 @@ protected function calculateProductsTaxForOrder()
$tax_to_add = zen_calculate_tax($tax_info['subtotal'], $tax_info['tax_rate']);
} else {
$tax_rate = $tax_info['tax_rate'];
$tax_rate_divisor = ($tax_rate >= 10) ? "1.$tax_rate" : "1.0$tax_rate";
$tax_to_add = $tax_info['subtotal'] - $tax_info['subtotal'] / $tax_rate_divisor;
//$tax_rate_divisor = ($tax_rate >= 10) ? "1.$tax_rate" : "1.0$tax_rate";
//$tax_rate_divisor = 1 + ($tax_rate / 100);
$tax_to_add = $tax_info['subtotal'] - $tax_info['subtotal'] / (1 + ($tax_rate / 100));
}

$this->info['tax'] += $tax_to_add;
Expand Down
2 changes: 1 addition & 1 deletion includes/functions/functions_taxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function zen_get_multiple_tax_rates($class_id, $country_id = -1, $zone_id = -1,
$rates_array = [];

if ($country_id == -1 && $zone_id == -1) {
if (zen_is_logged_in()) {
if (zen_is_logged_in() && STORE_PRODUCT_TAX_BASIS != 'Store') {
$country_id = $_SESSION['customer_country_id'];
$zone_id = $_SESSION['customer_zone_id'];
} else {
Expand Down

0 comments on commit d157dde

Please sign in to comment.