Include WC Cart functions for REST API calls

This commit is contained in:
Timur Gogolev 2022-12-26 16:02:23 +03:00
parent 61ee3eb46a
commit 4647efa840
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Load wc_empty_cart function for REST API calls.

View File

@ -369,7 +369,11 @@ class WC_Session_Handler extends WC_Session {
public function forget_session() {
wc_setcookie( $this->_cookie, '', time() - YEAR_IN_SECONDS, $this->use_secure_cookie(), true );
wc_empty_cart();
if( ! is_admin() ) {
include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
wc_empty_cart();
}
$this->_data = array();
$this->_dirty = false;