Index: ubercart/uc_product_kit/uc_product_kit.module
===================================================================
--- ubercart/uc_product_kit/uc_product_kit.module	(revision 1106)
+++ ubercart/uc_product_kit/uc_product_kit.module	(working copy)
@@ -895,12 +895,38 @@
 function uc_product_kit_add_to_cart($nid, $qty, $kit_data) {
   $node = node_load($nid);
   if ($node->type == 'product_kit') {
-    $unique = uniqid('', TRUE);
-    foreach ($node->products as $product) {
-      $data = array('kit_id' => $node->nid, 'unique_id' => $unique, 'module' => 'uc_product_kit');
-      uc_cart_add_item($product->nid, $product->qty * $qty, $data +  module_invoke_all('add_to_cart_data', $kit_data['products'][$product->nid]), NULL, FALSE, FALSE, FALSE);
+
+    /* see if we already have this kit in our cart, if so, we can just update the quantity */
+    $cid = uc_cart_get_id();
+    $unique = FALSE;
+
+    foreach($node->products as $product) {
+      $items = db_query("SELECT * FROM {uc_cart_products} WHERE cart_id = '%s' AND nid = %d", $cid, $product->nid);
+      while(($item = db_fetch_object($items))) {
+        $data = unserialize($item->data);
+        if ($data['kit_id'] == $node->nid) {
+          if ($unique && $unique != $data['unique_id'])
+            /* this is the same type of kit, but another instance, don't touch */
+            continue;
+          /* this product is for our kit! */
+          $unique = $data['unique_id'];
+          db_query("UPDATE {uc_cart_products} SET qty = qty + %d WHERE cart_item_id = %d",
+                   $product->qty * $qty, $item->cart_item_id);
+          /* there should only be one product of this type for our kit, so we can break now (and continue with the next product) */
+          break;
+        }
+      }
     }
 
+    if (!$unique) {
+      /* kit is new, add it */
+      $unique = uniqid('', TRUE);
+      foreach ($node->products as $product) {
+        $data = array('kit_id' => $node->nid, 'unique_id' => $unique, 'module' => 'uc_product_kit');
+        uc_cart_add_item($product->nid, $product->qty * $qty, $data +  module_invoke_all('add_to_cart_data', $kit_data['products'][$product->nid]), NULL, FALSE, FALSE, FALSE);
+      }
+    }
+
     // Rebuild the cart items cache.
     uc_cart_get_contents(NULL, 'rebuild');
 
