Answers.Body: <p>I'm not clear on what you're asking.</p>
  
  <p>A user's cart is created as soon as they land on any page that has <code>{% set cart = craft.commerce.cart %}</code> in it; whether they are a logged in user or not. Carts are not attached to Users until the order is complete (and only if you were a logged in user). You can have a cart as a guest, add to it, then log in and you'll still have the same cart.</p>
  
  <p>Are you saying that you want someone to fill out a cart, pay for it, complete the order - then be logged out immediately? Why? If they complete an order and then make another order it will already be a different cart.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-23T01:52:39.623Z
Answers.Text: That is what I had wanted, the way the site works, having a cart with multiple items wouldn't work, so they would add to the cart, pay, and then I wanted to log them out. I found a work around for this uniquely strange checkout. Although, It is something I would like to know for future reference. The cart can expire, but It would be nice to have that control, if needed.
Answers.UserDisplayName: SpoonShoe
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-21T16:26:27.790Z
Answers.LastActivityDate: 2016-10-21T18:23:16.340Z
Answers.LastEditDate: 2016-10-21T18:23:16.340Z
Answers.UserDisplayName: Matt Wilcox
Body: <p>In the sample code, Logout doesn't actually do anything. Once a user has created a cart / order and the go to a different page, I want to force log them out, so if they go back to the cart page, it's a new order etc where they have to enter their email in again. Thanks</p>
  
Tags: <plugin-craftcommerce>
Title: How do I log out a guest user?
ThreadText: # How do I log out a guest user?
  
  (Asked by: username_0 on 2016-10-20)
  
  In the sample code, Logout doesn't actually do anything. Once a user has created a cart / order and the go to a different page, I want to force log them out, so if they go back to the cart page, it's a new order etc where they have to enter their email in again. Thanks
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-10-21. Score: 2
  
  I'm not clear on what you're asking.
  
  A user's cart is created as soon as they land on any page that has `{% set cart = craft.commerce.cart %}` in it; whether they are a logged in user or not. Carts are not attached to Users until the order is complete (and only if you were a logged in user). You can have a cart as a guest, add to it, then log in and you'll still have the same cart.
  
  Are you saying that you want someone to fill out a cart, pay for it, complete the order - then be logged out immediately? Why? If they complete an order and then make another order it will already be a different cart.
  
  > **Comments:**
  > **username_0**: That is what I had wanted, the way the site works, having a cart with multiple items wouldn't work, so they would add to the cart, pay, and then I wanted to log them out. I found a work around for this uniquely strange checkout. Although, It is something I would like to know for future reference. The cart can expire, but It would be nice to have that control, if needed.  
  
  ---
  
  