diff --git a/modules/line_item/commerce_line_item.module b/modules/line_item/commerce_line_item.module
index 7dfe3b9..e36cb40 100644
--- a/modules/line_item/commerce_line_item.module
+++ b/modules/line_item/commerce_line_item.module
@@ -95,6 +95,42 @@ function commerce_line_item_hook_info() {
   return $hooks;
 }
 
+/**
+ * Implements hook_cron().
+ */
+function commerce_line_item_cron() {
+  if (variable_get('commerce_line_item_prune_orphaned_line_items', FALSE)) {
+    // Cron operation to prune orphaned line items that were created
+    // but are no longer are associated with an order.
+    $query = 'SELECT line_item_id FROM {commerce_line_item} li
+    LEFT JOIN {field_data_commerce_line_items} fdcli
+    ON li.line_item_id = fdcli.commerce_line_items_line_item_id
+    WHERE fdcli.commerce_line_items_line_item_id IS NULL
+    AND li.created < :timestamp
+    ORDER BY li.order_id
+    LIMIT 100';
+
+    $line_item_ids = db_query($query, array(':timestamp' => strtotime('-1 day')))->fetchAllKeyed(0, 0);
+
+    if (!empty($line_item_ids)) {
+      commerce_line_item_delete_multiple($line_item_ids);
+    }
+  }
+}
+
+/**
+ * Implements hook_form_FORM_ID_alter().
+ */
+function commerce_line_item_form_commerce_order_settings_form_alter(&$form, &$form_state) {
+  // Adds a checkbox to the order settings form to enable orphaned line item pruning.
+  $form['commerce_line_item_prune_orphaned_line_items'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable a cron job to prune orphaned line items.'),
+    '#description' => t('When line items are created on an order, but the order is not saved, it can lead to orphaned line items. This setting enables a cron job to delete these items.'),
+    '#default_value' => variable_get('commerce_line_item_prune_orphaned_line_items', FALSE),
+    '#weight' => 21,
+  );
+}
 
 /**
  * Implements hook_form_alter().
@@ -1590,3 +1626,37 @@ 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)) {
+
+    // Load line item ids on the order to make sure they're excluded.
+    if (!empty($order->commerce_line_items)) {
+      $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
+      $line_item_ids = $order_wrapper->commerce_line_items->raw();
+    }
+
+    // Build a query to load orphaned line items.
+    $query = 'SELECT line_item_id FROM {commerce_line_item} WHERE order_id = :order_id';
+    $args = array(':order_id' => $order->order_id);
+
+    // Append a NOT IN statement for existing line items if they exist.
+    if (!empty($line_item_ids)) {
+      $query .= ' AND line_item_id NOT IN (:line_item_ids)';
+      $args[':line_item_ids'] = $line_item_ids;
+    }
+
+    $orphaned_line_items = db_query($query, $args)->fetchAllKeyed(0, 0);
+
+    // Bulk delete any line items that are orphaned.
+    if (!empty($orphaned_line_items)) {
+      commerce_line_item_delete_multiple($orphaned_line_items);
+    }
+  }
+}
