magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.52k stars 9.31k forks source link

mini cart does not clear after placing an order - magento 2.0.7 #5621

Closed nmallepally closed 7 years ago

nmallepally commented 8 years ago

Hello,

After i have completed the purchase or placing an order the cart still shows the items and does not remove itself untill any new products added again. it is misleading. can any one give some insight on this?. do i need to upgrade 2.1 to fix or is there any alternative solution.

Thanks, Navya

andimov commented 8 years ago

@nmallepally Thanks for reporting. Please, format this issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result.

nmallepally commented 8 years ago

Hi @andimov Updated 2.0.7 to 2.1 Product added n checkout Payment method: Paypal/Cash on Delivery Payment done successfully mini cart is not cleared, shows up same products in mini cart.

mrkhoa99 commented 8 years ago

@nmallepally you can read more here: http://magento.stackexchange.com/questions/127203/magento-2-minicart-does-not-clear-items-after-checkout/127347#127347

andimov commented 8 years ago

@nmallepally Did you check solution from @mrkhoa99 ?

nmallepally commented 8 years ago

@andimov I'm checking it after the changes, will update in few minutes.

nmallepally commented 8 years ago

@andimov It returned me a different errors. Applied changes from this fix After payment the page returns a network error, page not working on success page, when clicked on reload. Returns a page checkout/cart saying not items in the cart, which it should not and yet displays the items in the cart. During the above process payment is made and order is generated. Attaching images for reference: cart error error cart 1

nmallepally commented 8 years ago

@mrkhoa99 Did you see my result above for the fix?, can you advise any alternative solution as we planning to go live in 2days.

mrkhoa99 commented 8 years ago

@nmallepally try to get the cart info from your local storage: localStorage.getItem('mage-cache-storage'). Seem the local storage not clear. There is a temporary solution for you, navigate to vendor/magento/module-checkout/view/frontend/templates/cart/noItems.phtml, add the following js code:

<script>
    require([
        'Magento_Customer/js/customer-data'
    ], function (customerData) {
        var sections = ['cart'];
        customerData.invalidate(sections);
        customerData.reload(sections, true);
    });
</script>
nmallepally commented 8 years ago

@mrkhoa99 Hi thanks for the quick response. works like a charm for paypal orders, does not clear cart when payment is done for cash on delivery method.

mrkhoa99 commented 8 years ago

@nmallepally Can you list the files which you applied the paths?

nmallepally commented 8 years ago

I'm using magento 2.1v. I just applied the above java script into vendor/magento/module-checkout/view/frontend/templates/cart/noItems.phtml. As you said this is a temporary solution. Did i miss anything?

PieterCappelle commented 8 years ago

Any update on this one? Still exists in 2.1.2.

bh-ref commented 7 years ago

encountered this bug in CE 2.1.4 as well. it happens when I DON'T sign into my customer account at checkout.

refaelgold commented 7 years ago

same here. waiting for update

danielmartinezd commented 7 years ago

In EE 2.1.5 Still happening

IlnitskiyArtem commented 7 years ago

@nmallepally Thanks for the feedback. Is your issue relevant for latest Magento versions? We need more information about your configuration to reproduce this issue. Please identify the web server you are running, the versions of PHP and MySQL, and any other information needed to reproduce your issue.

nmallepally commented 7 years ago

Hi, I have updated to Magento version 2.1.6, I have no issues now. the cart clears after placing an order.

Thanks.

silici0 commented 7 years ago

Hello, Im using Magento 2.1.7 fresh install and the problem persist, i have changed /vender/magento, is this the best practice?

korostii commented 7 years ago

No, editing /vendor/magento isn't considered best practice because your changes will be overwritten with stock files once you update to a newer version of Magento. You'll need to keep track of the all the patches you've applied and re-apply them after each update if you select this method.

orlangur commented 7 years ago

I've even met some composer plugins which allow to re-apply patches automatically 🤣 Please don't go this way.

@silici0 just customize needed template according to http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/templates/template-override.html#override mentioning in comment where the patch came from and for which version so that you can easily drop it when it is not relevant anymore due to Magento upgrade.

silici0 commented 7 years ago

@orlangur Ty, i have uploaded a module that fix the problem, im still learning, i would appreciate a code review :)

magento-engcom-team commented 7 years ago

@nmallepally, thank you for your report. The issue is already fixed in develop branch, 2.2.0, 2.1.9

mekiran16 commented 6 years ago

Hello, Please add below small script in following file path. it's work for me.

app/design/frontend///Magento_Checkout/templates/cart/noItems.phtml app/design/frontend///Magento_Checkout/templates/success.phtml

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

Thanks