public static function getProductTaxRate($id_product, $id_address = null, Context $context = null)
{
if ($context == null)
$context = Context::getContext();
$address = Address::initialize($id_address);
$groups = Customer::getGroupsStatic((int)($address->id_customer));
$taxratenew = null;
foreach ($groups as $g) {
if ($g == 8 || $g == 9) { //set the group you want here ( '>;' or '=')
return 0; //set the tax rate you want here (e.g. "0")
}
}
if (!$taxratenew) {
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct($id_product, $context);
$tax_manager = TaxManagerFactory::getManager($address, $id_tax_rules);
$tax_calculator = $tax_manager->getTaxCalculator();
$taxratenew = $tax_calculator->getTotalRate();
}
return $taxratenew;
}
Try this, it works with tax = 0;