Magento – Magento 2 Minicart cant remove items

magento2mini-cart

When I try to remove an item from the minicart I get this popup message: "Attention We can't find the quote item."

Best Answer

Because you have already deleted that items but your minicart is not refreshed thats default magento2's bug.

https://github.com/magento/magento2/issues/5377

https://github.com/magento/magento2/issues/4170

for the temporary solution, you can refresh mini cart in all page for that you can use below code.

default.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <body>
    <referenceContainer name="content">
        <block class="Magento\Framework\View\Element\Template" name="refresh.minicart" template="{vendor}_{module}::refreshMinicart.phtml"  />
    </referenceContainer>
  </body>
</page>

refreshMinicart.phtml

<script>
  require([
    'Magento_Customer/js/customer-data'
  ], function (customerData) {
    var sections = ['cart'];
    customerData.invalidate(sections);
  });
</script>