title: How can I set cart expiration in Woocommerce strictly when users leaves cart. As well as time restricted?
body: <p>SO this is only works for time. I'd like also session/cart to be emptied when moving to a different page.. i.e. out of cart/checkout</p>
  <pre><code>add_filter('wc_session_expiring', 'filter_ExtendSessionExpiring' );
  add_filter('wc_session_expiration' , 'filter_ExtendSessionExpired' );
  
  function filter_ExtendSessionExpiring($seconds) {
      global $woocommerce;
  
      $woocommerce-&gt;session-&gt;set_customer_session_cookie(true);
          return 60 * 30;
          WC()-&gt;cart-&gt;empty_cart();
          WC()-&gt;session-&gt;destroy_session();
  }
  
  function filter_ExtendSessionExpired($seconds) {
      global $woocommerce;
  
      $woocommerce-&gt;session-&gt;set_customer_session_cookie(true);
          return 60 * 30;
          WC()-&gt;cart-&gt;empty_cart();
          WC()-&gt;session-&gt;destroy_session();
  }
  </code></pre>