Skip to content

Magento 2 – mini-cart – tax / price issue – after returning from checkout

I have a question about the minicart.

In my Magento 2.4.3 I have different tax classes per store view. When I change the store view,
the prices also change with the respective tax rate (also in the mini cart). Everything works well so far.

The problem occurs as soon as I put product(s) in the shopping cart and then go to checkout. If I now leave the checkout area again,
the mini shopping cart retains the price (with the tax rate) as it was in the checkout and no longer changes if I change the StoreView.
As soon as I remove the product(s) from the minicart and add them back, everything works correctly again.

From my point of view, Magento seems to cache something from the checkout area here (maybe the shipping country, cookies or something else)

I’ve already tried a few solutions but unfortunately all of them were unsuccessful.

One solution was to reload the customer data and add the cart section like follows:

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

But there are several issues with this solution outside of the checkout area
for example it canĀ“t load the needed scripts and functions and I also tried to add these missing pieces
But no matter how I try to adapt the code, problems continue to arise

I also tried to modify the minicart.phtml also not working for me.

I would be very grateful for any advice.