diff --git a/modules/line_item/commerce_line_item.module b/modules/line_item/commerce_line_item.module
index 7dfe3b9..595df2d 100644
--- a/modules/line_item/commerce_line_item.module
+++ b/modules/line_item/commerce_line_item.module
@@ -1590,3 +1590,30 @@ function commerce_line_item_field_views_data($field) {
 
   return $data;
 }
+
+
+/**
+ * Implements hook_entity_update().
+ *
+ * Prune orphaned line items that may have been added to the
+ * database, but are not associated with the order any longer.
+ */
+function commerce_line_item_commerce_order_update($order) {
+  if (!empty($order->order_id)) {
+    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
+
+    try {
+      $line_item_ids = (array) $order_wrapper->commerce_line_items->raw();
+    } catch (Exception $ex) {
+      $ine_item_ids = array();
+    }
+    $orphaned_line_items = db_query('SELECT line_item_id FROM {commerce_line_item} WHERE order_id = :order_id AND line_item_id NOT IN(:line_item_ids)', array(
+      ':order_id' => $order->order_id,
+      ':line_item_ids' => $line_item_ids
+    ))->fetchAllKeyed(0, 0);
+
+    foreach ((array) $orphaned_line_items as $orphaned_line_item) {
+      commerce_line_item_delete($orphaned_line_item);
+    }
+  }
+}
