cart not getting empty after success page redirection done in magento 2
-
14-04-2021 - |
Pergunta
How can I empty my cart value when order successfully done in Magento 2. This issue only done with logged-in user how can I handle this issue. Is there any solution for this?
Solução
For update minicart section first we create a sections.xml in /etc/frontend/
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Customer:etc/sections.xsd">
<action name="test/process/observer">
<section name="cart"/>
</action>
</config>
And after apply Ajax on particular section phtml
And one more solution founded
require([
'Magento_Customer/js/customer-data'
], function (customerData) {
var sections = ['cart'];
customerData.invalidate(sections);
customerData.reload(sections, true);
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange