Anonymous users getting same product items in cart
I would guess it has to do with:

$order = commerce_cart_order_load($uid);


Since all anonymous users are assigned uid:0, it could be drawing from all products currently associated with that uid (which would be all anonymous users), rather then the products from the current user's session