function commerce_cart_commerce_product_calculate_sell_price_line_item_alter in Commerce Core 7
Implements hook_commerce_product_calculate_sell_price_line_item_alter().
File
- modules/
cart/ commerce_cart.module, line 561 - Implements the shopping cart system and add to cart features.
Code
function commerce_cart_commerce_product_calculate_sell_price_line_item_alter($line_item) {
global $user;
// Reference the current shopping cart order in the line item if it isn't set.
// We load the complete order at this time to ensure it primes the order cache
// and avoid any untraceable recursive loops.
// @see http://drupal.org/node/1268472
if (empty($line_item->order_id)) {
$order = commerce_cart_order_load($user->uid);
if ($order) {
$line_item->order_id = $order->order_id;
}
}
}