diff --git a/modules/cart/commerce_cart.module b/modules/cart/commerce_cart.module index ae8867a..e132da8 100644 --- a/modules/cart/commerce_cart.module +++ b/modules/cart/commerce_cart.module @@ -628,7 +628,10 @@ function commerce_cart_order_id($uid = 0) { // else's order data. Therefore, this query restricts its search to // orders assigned to anonymous users using the same IP address to try // and mitigate risk as much as possible. - return db_query('SELECT order_id FROM {commerce_order} WHERE order_id IN (:order_ids) AND uid = 0 AND hostname = :hostname AND status IN (:status_ids) ORDER BY order_id DESC', array(':order_ids' => commerce_cart_order_session_order_ids(), ':hostname' => ip_address(), ':status_ids' => $status_ids))->fetchField(); + + // Commerce cart original code checked user IP to assign a cart to it, if the user had already a cart + // and his/her IP changes, user ends with 2 carts + return db_query('SELECT order_id FROM {commerce_order} WHERE order_id IN (:order_ids) AND uid = 0 AND status IN (:status_ids) ORDER BY order_id DESC', array(':order_ids' => commerce_cart_order_session_order_ids(), ':status_ids' => $status_ids))->fetchField(); } } }