Jumprit's Knowledge

Jumprit's knowledge and references to share.

Tax Exempt for Specified Group – Opencart —

To exclude customers in a particular group from paying tax:

in system/library/tax.php change this:

public function getRate($tax_class_id) {
if (isset($this->taxes[$tax_class_id])) {
$rate = 0;
foreach ($this->taxes[$tax_class_id] as $tax_rate) {
$rate += $tax_rate['rate'];
}
return $rate;
} else {
return 0;
}
}

into this:

public function getRate($tax_class_id) {
if (isset($this->taxes[$tax_class_id])) {
$rate = 0;
//taxfree part 1
global $registry;
$this->customer = $registry->get('customer');
if ($this->customer->getCustomerGroupId() == '8') {
} else {
//end of part 1
foreach ($this->taxes[$tax_class_id] as $tax_rate) {
$rate += $tax_rate['rate'];
}

return $rate;
// part 2
}
// end of part 2

} else {
return 0;
}
}

(change 8 to other user group id to suit your need)

to find user group id, mouse over on edit user group item in admin area.

To exempt all but group id 8, change the ==’8′ to !=’8′

Have fun..!! 😎


Categorised as: Opencart



Leave a Reply