You are here

function commerce_registration_delete_line_item in Commerce Registration 7

Action callback.

Removes the line item from the order.

Related topics

1 string reference to 'commerce_registration_delete_line_item'
commerce_registration_rules_action_info in ./commerce_registration.rules.inc
Implements hook_rules_action_info().

File

./commerce_registration.rules.inc, line 538
Commerce Registration rules file.

Code

function commerce_registration_delete_line_item($line_item) {
  $line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
  $order = commerce_order_load($line_item_wrapper->order_id
    ->value());

  // Delete the old line_item.
  $order = commerce_cart_order_product_line_item_delete($order, $line_item->line_item_id);
  commerce_order_save($order);
}