function commerce_avatax_commerce_order_update in Drupal Commerce Connector for AvaTax 7.3
Implements hook_commerce_order_update().
File
- ./
commerce_avatax.module, line 159 - Calculate Sales Tax using AvaTax Calc service from Avalara, Inc.
Code
function commerce_avatax_commerce_order_update($order) {
// Calculate sales tax between shipping module and review checkout.
if (!variable_get('commerce_avatax_checkout_form', '') && variable_get('commerce_avatax_tax_address', '') == 'Shipping') {
if ($order->original->status == 'checkout_shipping' && $order->status == 'checkout_review' && !isset($order->avatax)) {
commerce_avatax_calculate_sales_tax($order);
}
}
// Delete sales tax line item if cart is updated
if ($order->status == 'cart') {
if ($order->original->commerce_order_total['und'][0]['amount'] != $order->commerce_order_total['und'][0]['amount']) {
commerce_avatax_delete_avatax_line_items($order);
}
}
}