The cart associated with the logged-in user is a distinct cart from the one associated with the anonymous user.  The cart will not be shared.

Website users who do not log in to your site can still add items to shopping carts.

To identify these anonymous users, the program uses cookies. To return to their shopping carts, users who did not log in must use the same computer as when they added transactions. If multiple users add transactions from a computer without logging in, the program adds all the transactions to a single shopping cart.