You are here

function hook_commerce_product_calculate_sell_price_line_item_alter in Commerce Core 7

Allows modules to alter the product line item used for sell price calculation.

Parameters

$line_item: The product line item used for sell price calculation.

1 function implements hook_commerce_product_calculate_sell_price_line_item_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

commerce_cart_commerce_product_calculate_sell_price_line_item_alter in modules/cart/commerce_cart.module
Implements hook_commerce_product_calculate_sell_price_line_item_alter().
2 invocations of hook_commerce_product_calculate_sell_price_line_item_alter()
commerce_cart_add_to_cart_form_submit in modules/cart/commerce_cart.module
Form submit handler: add the selected product to the cart.
commerce_product_calculate_sell_price in modules/product_pricing/commerce_product_pricing.module
Returns the calculated sell price for the given product.

File

modules/product_pricing/commerce_product_pricing.api.php, line 70
Hooks provided by the Product Pricing module.

Code

function hook_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.
  if (empty($line_item->order_id)) {
    $line_item->order_id = commerce_cart_order_id($user->uid);
  }
}