Index: sites/all/modules/ecommerce/cart/cart.module =================================================================== --- sites/all/modules/ecommerce/cart/cart.module (original) +++ sites/all/modules/ecommerce/cart/cart.module (modified) @@ -126,9 +126,9 @@ switch ($op) { case 'login': // Convert their cart session to a permanent user cart at login. - if (isset($_SESSION['cart_id'])) { - db_query("UPDATE {ec_cart} SET cookie_id = %d WHERE cookie_id = '%s'", $user->uid, $_SESSION['cart_id']); - unset($_SESSION['cart_id']); + if (isset($_COOKIE['cart_id'])) { + db_query("UPDATE {ec_cart} SET cookie_id = %d WHERE cookie_id = '%s'", $user->uid, $_COOKIE['cart_id']); + setcookie('cart_id', null); } break; } @@ -943,6 +943,7 @@ } elseif ($sid = session_id()) { // Use session id until the user registers, then switch to user id. + setcookie('cart_id', $sid); return $sid; } } @@ -1029,7 +1030,7 @@ // Rebuild the items hash $items = cart_get_items(NULL, 'rebuild'); if (empty($items)) { - unset($_SESSION['cart_id']); + setcookie('cart_id', null); } if (!strstr(request_uri(), 'cart/view')) { drupal_set_message(t('Your item(s) have been updated.')); @@ -1072,7 +1073,7 @@ } $cookie_id = ($cookie_id) ? $cookie_id : cart_get_id(); - unset($_SESSION['cart_id']); + setcookie('cart_id', null); return db_query("DELETE FROM {ec_cart} WHERE cookie_id = '%s'", $cookie_id); }