2

We are having some issues when a customer try to remove the last (one) item from the shopping cart before it becomes empty, the only message that comes up is: We can't remove the item.

I have no idea why or how to fix it, or at least how to debug it.

Any help is appreciated.

Thanks

UPDATE - SOLUTION IN MY CASE

Posted by @ivankaranjac on this Post :

Problem with deleting, updating and adding to cart once an item is added to the cart

traced the problem to vendor/magento/module-quote/Model/ShippingAddressManagement.php#120

commented out that if and it all seams to work fine now.

1
  • If you know what you are doing, try disabling any extensions that you have temporarily, ideally on a testing site or locally instead of on production, then test the cart. Sometimes extensions break things like the cart. If you know how to code you could also debug the code, but if not I would try to find a Magento support company that has certified programmers that can help you.
    – NendoTaka
    Commented Aug 18, 2016 at 22:27

2 Answers 2

0

Do you have minimum orders turned on? There appears to be a bug that matches your problem, which occurs when minimum orders is turned on.

1
  • I do have a minimum order turned on. Actually the reported bug is exactly what I"m seeing.
    – user37025
    Commented Aug 18, 2016 at 23:18
0

To come up from this problem I have created one simple module to solve this problem.

1) Create new module. Namespace_ModuleName

2) Create required registration.php and module.xml file

3) create di.xml and add following code

   <type name="Magento\Quote\Model\Quote">
            <plugin name="min-orderamount-skip-delete" type="Namespace\ModuleName\Model\Quote" sortOrder="10"/>
        </type>

4) Create a class app\code\Namespace\ModuleName\Model\Quote.php

CONST DELETE_ACTION_NAME = 'delete';
    /**
     * @var RequestInterface
     */
    private $request;

    public function __construct(\Magento\Framework\App\RequestInterface $request)
    {
        $this->request = $request;
    }


    public function afterValidateMinimumAmount()
    {
        $actionName = $this->request->getActionName();
        if($actionName === self::DELETE_ACTION_NAME) {
            return true;
        }
    }

5) Run bin/magento cache:flush and bin/magento setup:upgrade command from terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.