cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 cannot remove item form cart after upgrade php version

SOLVED

Re: Magento 2 cannot remove item form cart after upgrade php version

Hello @cheung_hoi ching2 

 

are you using module for ajax add to cart or mini cart delete then disable it and check it


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Magento 2 cannot remove item form cart after upgrade php version

Hello @cheung_hoi ching2 

 

seems like form key issue

 

if you go to https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Checkout/Controller/Sidebar/Re...

and 

if (!$this->getFormKeyValidator()->validate($this->getRequest())) {
            return $this->resultRedirectFactory->create()->setPath('*/cart/');
        }

remove this code and check it.

if works then form key issue

 

if works then mark as solution,


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Magento 2 cannot remove item form cart after upgrade php version

Removing this solves the issue,

if (!$this->getFormKeyValidator()->validate($this->getRequest())) {
            return $this->resultRedirectFactory->create()->setPath('*/cart/');
        }

but looks like it's not good to remove this validation. Maybe in future, it will result in more problems? Is there another way out.

Uncaught TypeError: Argument 2 passed to Magento\GoogleShoppingAds\Plugin\DeleteProductFromSidebar::afterExecute() must be an instance of Magento\Framework\App\Response\Http, instance of Magento\Framework\Controller\Result\Redirect\Interceptor given

Above is the error for me.