How to set up login/guest and checkout/add to cart
Why not have account_id always populated? When anyone who creates a shopping bag, they get an account_id auto assigned, but there's another field on the account table with a boolean is_guest flag set true by default. You could keep things like customer details in a separate table with a 1:1 map to the account table, for customers who do create accounts.

Your challenge then is that you might have repeat customers with different account_ids, but might be worth it depending on how likely customers will create accounts.