improve code to handle cart after loggin