News:

Looking for documentation? Take a look on our wiki

Main Menu

AvaTax Frieght Tax Code Fix

Started by jessedyck, November 30, 2018, 18:16:59 PM

Previous topic - Next topic

jessedyck

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).

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/