cancel
Showing results for 
Search instead for 
Did you mean: 

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

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.

6 REPLIES 6

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

Some info is missing to be able to tell you what's going on in your case.

 

When you say "I have different tax classes per store view" - do you mean product tax classes? If so, these are website scoped, not store view scoped.

 

How is your Stores > Sales > Tax area configured?

Founder at https://agency418.com

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

thank you for your reply.

my mistake I mean different Stores.
I switch the stores with language-switcher.

The tax is set in Stores > Taxes > Tax Rules / Tax Zones and Rates for every country

Like mentioned all is working as expected

But as soon as I go to the checkout with a product in shopping cart and then leave the checkout area again, the problem occurs.

Please let me know if any further information is needed.

Thank you again

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

Hi, it is impossible to answer without knowing how your Stores > Sales > Tax area is configured for different scopes. 

 

Depending on how that part is configured, what you're experiencing can be expected behaviour. 

Founder at https://agency418.com

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

In configuration > sales > tax I have the following settings:

 

tax-settings.jpg

And as Default Tax Destination Calculation I have set the corresponding country for the assigned store.

 

And following the Tax Zones and Rates:

 

tax-zones-and-rates.jpg

And Tax Rules:

tax-rules.jpg

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

We can't see the screenshots you uploaded, but based on the extra context you added:

 

If your tax calculation is based on customer's shipping/billing address and you entered the shipping/billing address during checkout, it is expected behaviour that that address now overrides the default "Default Tax Destination Calculation" throughout the rest of the session of the customer as you now have customer's exact address and there is no point to load the default tax destination.

 

Founder at https://agency418.com

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

thank you for your feedback and sorry for my late reply.

 

Do you think there is some way to avoid this behaviour.

 

I mean if a customer already have entered his full address,

for example the address is saved in his customer account then this behaviour is logical from my point of view.

But if a customer (Guest) is not logged in goes to cart(checkout) and the shipping country is automaticly selected per Store then from my point of view if he goes to cart(checkout) or not and switches the store this should not happen.

It should be like it is if he was not on the cart(checkout) page and like mentioned this is working before he visit the checkout.

 

Thank you again for your efforts.