After I updated from Magento version 2.2.3 to 2.2.6 the shopping cart stopped clearing after I click "Clear Shopping Cart" on the cart page.

After I click the button, the page reloads but everything remains the same.

I am using Ultimo theme but I have checked and it doesn't overwrite this behavior anyhow.

What could be the possible issue and where should I start my investigation from?

  • I am having same issue with Magento 2.2.6 and Latest version of Ultimo theme. Did you find a solution? This is exception I am seeing in log file. main.CRITICAL: Requested product doesn't exist {"exception":"[object] (Magento\\Framework\\Exception\\NoSuchEntityException(code: 0): Requested product doesn't exist at /home/web/site/public_html/vendor/magento/module-catalog/Model/ProductRepository.php:271) – Zoya Nov 24 '18 at 12:20
  • @Haya Check phagento answer – Ilja Davidovs Nov 26 '18 at 10:46

I've also encountered this issue and I've found out that in vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml ~line 27, Magento Team seems missed to put a dot for the 'action' classname. It's a small mistake that creates a big problem. Hopefully this will be fixed in 2.2.7

So from


It should be


*Note: Please don't edit the file in



| improve this answer | |
  • I just checked one of my 2.2.7 websites and this issue is still present. I don't like the button personally (its hidden w/ css) but I don't think they've yet realized they need to fix this. – jamil Jan 18 '19 at 18:23

When a user clicks on Clear Shopping Cart button then you have to check below:

  • On click on this button the http://{Example.com}/checkout/cart/updatePost/ should hit.

  • This URL must hit via POST request.

    This post request must have form_key and update_cart_action, and update_cart_action value should be empty_cart

FORM DATA should like when to click on Clear Shopping Cart

form_key: 4VQpuhYHzS9dOY3P
cart[15][qty]: 1
cart[17][qty]: 1
update_cart_action: empty_cart

Where 15,17 are cart item id.

If those are available or exist then the exception is not happening. You check error, check the exception log or changes

$this->messageManager->addException($exception, __('We can\'t update the shopping cart.'));


| improve this answer | |
  • update_cart_action parameter is missing. Is it related to JavaScript? – Ilja Davidovs Oct 3 '18 at 9:32
  • @Amit Bera please check my answer – Ranganathan Oct 6 '18 at 5:05

The Problem is 'update_cart_action' Parameter is not sending because Mageno developers added 'Magento_Checkout/js/action/update-shopping-cart' js function for validation. They Submit the form in this file. So the submit button value param is not sending. Add the hidden field with submit button name in


<input type="hidden" id="update_cart_action_hidden" name="update_cart_action" value="">

And assign the value of submit button using onClick event to the hidden field


Hope this will work

| improve this answer | |

Checkout Cart Page >> Clear Shopping Cart button should have alert to the users if they want to clear or not.

Here I am overriding form.phtml in my theme.



 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.

// @codingStandardsIgnoreFile

/**  @var $block \Magento\Checkout\Block\Cart\Grid */
<?php $mergedCells = ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices() ? 2 : 1); ?>
<?= $block->getChildHtml('form_before') ?>
<form action="<?= /* @escapeNotVerified */ $block->getUrl('checkout/cart/updatePost') ?>"
              {"validationURL" : "/checkout/cart/updateItemQty"}
          class="form form-cart">
    <?= $block->getBlockHtml('formkey') ?>
    <div class="cart table-wrapper<?= $mergedCells == 2 ? ' detailed' : '' ?>">
        <?php if ($block->getPagerHtml()): ?>
            <div class="cart-products-toolbar cart-products-toolbar-top toolbar" data-attribute="cart-products-toolbar-top"><?= $block->getPagerHtml() ?></div>
        <?php endif ?>
        <table id="shopping-cart-table"
               class="cart items data table"
               data-mage-init='{"shoppingCart":{"emptyCartButton": ".action.clear",
               "updateCartActionContainer": "#update_cart_action_container"}}'>
            <caption role="heading" aria-level="2" class="table-caption"><?= /* @escapeNotVerified */ __('Shopping Cart Items') ?></caption>
                    <th class="col item" scope="col"><span><?= /* @escapeNotVerified */ __('Item') ?></span></th>
                    <th class="col price" scope="col"><span><?= /* @escapeNotVerified */ __('Price') ?></span></th>
                    <th class="col qty" scope="col"><span><?= /* @escapeNotVerified */ __('Qty') ?></span></th>
                    <th class="col subtotal" scope="col"><span><?= /* @escapeNotVerified */ __('Subtotal') ?></span></th>
            <?php foreach ($block->getItems() as $_item): ?>
                <?= $block->getItemHtml($_item) ?>
            <?php endforeach ?>
        <?php if ($block->getPagerHtml()): ?>
            <div class="cart-products-toolbar cart-products-toolbar-bottom toolbar" data-attribute="cart-products-toolbar-bottom"><?= $block->getPagerHtml() ?></div>
        <?php endif ?>
    <div class="cart main actions">
        <?php if ($block->getContinueShoppingUrl()): ?>
            <a class="action continue"
               href="<?= $block->escapeUrl($block->getContinueShoppingUrl()) ?>"
               title="<?= $block->escapeHtml(__('Continue Shopping')) ?>">
                <span><?= /* @escapeNotVerified */ __('Continue Shopping') ?></span>
        <?php endif; ?>
        <button type="button"
                title="<?php echo $block->escapeHtml(__('Clear Shopping Cart')); ?>"
                class="action clear" id="cp-empty_cart_button">
            <span><?php /* @escapeNotVerified */
                echo __('Clear Shopping Cart'); ?></span>
        <button type="submit"
                title="<?= $block->escapeHtml(__('Clear Shopping Cart')) ?>"
                class="action clear" id="empty_cart_button" style="display: none;">
            <span><?= /* @escapeNotVerified */ __('Clear Shopping Cart') ?></span>
        <button type="submit"
                title="<?= $block->escapeHtml(__('Update Shopping Cart')) ?>"
                class="action update">
            <span><?= /* @escapeNotVerified */ __('Update Shopping Cart') ?></span>
        <input type="hidden" value="" id="update_cart_action_container" data-cart-item-update=""/>
<?= $block->getChildHtml('checkout.cart.order.actions') ?>
<?= $block->getChildHtml('shopping.cart.table.after') ?>
<script type="text/javascript">
    ], function ($, alertt, confirmation) {
        $(document).ready(function () {
            $('#cp-empty_cart_button').on('click', function (event) {
                    title: '',
                    content: 'Are you sure to remove products from cart ?',
                    actions: {
                        confirm: function () {
                            window.location.href = '<?php /* @escapeNotVerified */ echo $block->getUrl('checkout/cart/updatePost'); ?>';
                        cancel: function () {
                    buttons: [{
                        text: $.mage.__('OK'),
                        class: 'action secondary cp-action-accept',
                         * Click handler.
                        click: function (event) {
                            this.closeModal(event, true);
                            text: $.mage.__('Cancel'),
                            class: 'action secondary action-dismiss',
                             * Click handler.
                            click: function (event) {

Output will be like this :-

enter image description here

| improve this answer | |

Its a default bug in Magento2 version : https://github.com/magento/magento2/issues/18475

To resolve this issue you need to override the file


into your theme


and change the line number 27 from action.clear to .action.clear

| improve this answer | |

It's default bug.

Here I am overriding form.phtml in my theme.


Two Changes required

1) At line no 17 :




2) At line no 27 :




| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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