News:

Looking for documentation? Take a look on our wiki

Main Menu

VM forgets stored cart after logout/login

Started by sandomatyas, March 11, 2020, 16:45:23 PM

Previous topic - Next topic

sandomatyas

There is a site with Joomla 3.9.14, VirtueMart 3.6.10 10211, PHP 7.4
I log in with a simple registered username, add something to the cart. I can see this item in #__virtuemart_carts.cartData in cartProductsData array. I log out, the product is still in the cart. I log in again and my cart is empty and the cartProductsData array is also empty
How should I debug/solve this?

sandomatyas

I checked a bit and found getCart method in class VirtueMartCart
if(empty(JFactory::getUser()->guest) and !empty($sessionCart->_guest)){
self::$_cart->loadCart(self::$_cart);
self::$_cart->_guest = 0;
}

If I remove the second condition and !empty($sessionCart->_guest) it works well.
Any guess?