Add a public method for forgetting a session without clearing it.

This commit is contained in:
John Blackbourn 2018-11-20 18:58:14 +01:00
parent c848bcda1b
commit 179aa0853d
1 changed files with 8 additions and 2 deletions

View File

@ -231,9 +231,15 @@ class WC_Session_Handler extends WC_Session {
* Destroy all session data.
*/
public function destroy_session() {
wc_setcookie( $this->_cookie, '', time() - YEAR_IN_SECONDS, apply_filters( 'wc_session_use_secure_cookie', false ) );
$this->delete_session( $this->_customer_id );
$this->forget_session();
}
/**
* Forget all session data without destroying it.
*/
public function forget_session() {
wc_setcookie( $this->_cookie, '', time() - YEAR_IN_SECONDS, apply_filters( 'wc_session_use_secure_cookie', false ) );
wc_empty_cart();