title: Woocommerce Cart not clearing
body: <p>I know there will be this type of questions but i have tried almost all options without luck so i'm asking here.</p>
  
  <p>I have issue that <code>cart</code> is not empty in woocommerce after order completed and also some users just add items to cart then not go to checkout and after somedays come back again they still see old cart.</p>
  
  <p>I think it may be caching issue as i'm using <code>W3-total-cache</code> plugin.</p>
  
  <p>I want to clear cart data after checkout or if user add items to cart and not checkout and after a while come back again for shopping then cart must be empty and should not store old session to cart.</p>
  
  <p>I tried below code but no luck :</p>
  
  <pre><code>function nom_empty_cart_init_login(){
      $opt = get_option('nom_empty_cart_browser_close_do_login');
      $opt = $opt != 1 ? false : true;
  
      if( $opt ){
          session_destroy();
      }
  }
  
  //  destroy session on user logout
  function nom_empty_cart_init_logout(){
      $opt = get_option('nom_empty_cart_browser_close_do_logout');
      $opt = $opt != 1 ? false : true;
  
      if( $opt ){
          session_destroy();
      }
  }
  
  add_action('admin_menu','nom_empty_cart_init_admin_init');
  function nom_empty_cart_init_admin_init(){
      add_options_page( 'Woocommerce Clear Cart on Browser Closing', 'WC Clear Cart on Browser Close', 'manage_options', 'wc-clear-cart-on-browser-close', 'wc_clear_cart_on_browser_close' );    
  }
  
  function wc_clear_cart_on_browser_close(){
  
      if( isset( $_REQUEST['save_accconc'] ) and wp_verify_nonce($_REQUEST['wc-clear-cart-on-browser-close-name'],'wc-clear-cart-on-browser-close-action')):
  
          //  SAVING THE FORM DATA
  
              //  enable wcccobc
              if( isset($_REQUEST['enable_wcccobc']) )
                  update_option('nom_empty_cart_browser_close_enable',1);
  
              //  enable wcccobc on login
              if( isset($_REQUEST['enable_wcccobc_on_login']) )
                  update_option('nom_empty_cart_browser_close_do_login',1);
  
              //  enable wcccobc on logout
              if( isset($_REQUEST['enable_wcccobc_on_logout']) )
                  update_option('nom_empty_cart_browser_close_do_logout',1);
  
  
          //  SAVING ;) ENDS
  
      endif;
  
      ?&gt;
      &lt;div class="wrap"&gt;
          &lt;div class="inside"&gt;
              &lt;h2&gt;Woocommerce Clear Cart on Browser Closing&lt;/h2&gt;
              &lt;p&gt;Note: the cart will be empty if the visitor close the whole browser, not just the widow. (will be updated soon)&lt;/p&gt;
  
              &lt;form action="&lt;?php admin_url('options-general.php?page=wc-clear-cart-on-browser-close');?&gt;" method="post"&gt;
                  &lt;?php wp_nonce_field('wc-clear-cart-on-browser-close-action','wc-clear-cart-on-browser-close-name')?&gt;
                  &lt;p&gt;
                      &lt;input id="enable_wcccobc" type="checkbox" class="checkbox" name="enable_wcccobc" value="1" &lt;?php checked(get_option('nom_empty_cart_browser_close_enable'),'1');?&gt;&gt;
                      &lt;label for="enable_wcccobc" &gt;Enable clear cart on browser closing&lt;/label&gt;                   
                  &lt;/p&gt;
                  &lt;p&gt;
                      &lt;input id="enable_wcccobc_on_login" type="checkbox" class="checkbox" name="enable_wcccobc_on_login" value="1" &lt;?php checked(get_option('nom_empty_cart_browser_close_do_login'),1);?&gt;&gt;
                      &lt;label for="enable_wcccobc_on_login" &gt;Enable clear cart on on user login&lt;/label&gt;                    
                  &lt;/p&gt;
                  &lt;p&gt;
                      &lt;input id="enable_wcccobc_on_logout" type="checkbox" class="checkbox" name="enable_wcccobc_on_logout" value="1" &lt;?php checked(get_option('nom_empty_cart_browser_close_do_logout'),1);?&gt;&gt;
                      &lt;label for="enable_wcccobc_on_logout"&gt;Enable clear cart on user logout&lt;/label&gt;                  
                  &lt;/p&gt;
                  &lt;p&gt;
                      &lt;input type="submit" class="button-primary" value="Save" name="save_accconc"&gt;
                  &lt;/p&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;?php 
  }
  </code></pre>