I've discovered the Frieght Tax Code (set in the Tax and Calculation Rules) isn't being sent to AvaTax due to a bug in the code, thus the freight tax code is not working.
In avalara.php, line 955, the code is getting the taxfrieghtcode index from $calc as an object, but $calc is an array. It's treated as an array throughout this file.
https://dev.virtuemart.net/projects/virtuemart/repository/entry/trunk/virtuemart/plugins/vmcalculation/avalara/avalara.php#L955
Change this:
if(!empty($product['shipment'])){
if(!empty($calc->taxfreightcode)) $line->setTaxCode($calc->taxfreightcode);
}
To this:
if(!empty($product['shipment'])){
if(!empty($calc['taxfreightcode'])) $line->setTaxCode($calc['taxfreightcode']);
}
Should be all that's needed; that fixed it for me using NT as the freight tax code (for no tax).
Thank you.
I use now
if(is_object($calc)){
if(!empty($calc->taxfreightcode)) $line->setTaxCode($calc->taxfreightcode);
} else {
if(!empty($calc['taxfreightcode'])) $line->setTaxCode($calc['taxfreightcode']);
}
to be sure.