function uc_taxes_apply_item_tax in Ubercart 6.2
Same name and namespace in other branches
- 7.3 uc_taxes/uc_taxes.module \uc_taxes_apply_item_tax()
Calculates tax for a single product.
1 call to uc_taxes_apply_item_tax()
- uc_taxes_apply_tax in uc_taxes/
uc_taxes.module - Applies taxes to an order.
File
- uc_taxes/
uc_taxes.module, line 492
Code
function uc_taxes_apply_item_tax($item, $tax) {
$node = node_load($item->nid);
// Special handling for manually added "Blank line" products.
if (!$node) {
$node = new stdClass();
$node->type = 'blank-line';
$node->shippable = $item->weight > 0;
}
// Tax products if they are of a taxed type and if it is shippable if
// the tax only applies to shippable products.
if (in_array($node->type, $tax->taxed_product_types) && ($tax->shippable == 0 || $node->shippable == 1)) {
$context = array(
'revision' => 'altered',
'type' => 'cart_item',
'subject' => array(
'cart_item' => $item,
'node' => $item->nid ? $node : FALSE,
),
);
$price_info = array(
'price' => $item->price,
'qty' => $item->qty,
);
return uc_price($price_info, $context);
}
}