function commerce_avatax_set_existing_line_item_price in Drupal Commerce Connector for AvaTax 7.5
Updates the unit price of the Avatax line item if it exists.
Parameters
EntityDrupalWrapper $order_wrapper: The wrapped order entity.
array $tax_price: A price array used to initialize the value of the line item's unit price.
string $tax_type: A string determining the price component to add.
Return value
object|bool The tax line item wrapper or FALSE if not found.
1 call to commerce_avatax_set_existing_line_item_price()
- commerce_avatax_calculate_tax in ./
commerce_avatax.module - Performs Tax calculation for a given order.
File
- ./
commerce_avatax.module, line 508 - AvaTax service integration from Avalara, Inc.
Code
function commerce_avatax_set_existing_line_item_price(EntityDrupalWrapper $order_wrapper, $tax_price, $tax_type) {
foreach ($order_wrapper->commerce_line_items as $line_item_wrapper) {
if (!$line_item_wrapper
->value() || $line_item_wrapper
->getBundle() != 'avatax') {
continue;
}
commerce_avatax_set_price_component($line_item_wrapper, $tax_price, $tax_type);
$line_item_wrapper
->save();
return $line_item_wrapper;
}
return FALSE;
}