I use the QuoteFactory in order to load the quote by id & add items. Then I save the quote & call $quote->setTotalsCollectedFlag(false)->collectTotals().
After that, I can see on the database that the quote item have been added & on the frontend I also see the right qty on the cart page, but the mini-cart on the header stays the same.
When I sign out & in again it gets updated.
*My guess is that I need to somehow force the customerData to reload on frontend (customerData.reload(['cart'])), but I don't know how/if it's possible to performs that on the server side...

enter image description here

-- Any idea?

  • Are there any JS errors in the browser's console? – Mohit Kumar Arora Oct 7 '18 at 8:08
  • No, there are no JS errors on console. – Pini Oct 7 '18 at 9:07
  • I hope, this link should help you: magento.stackexchange.com/questions/98869/… – Mohit Kumar Arora Oct 7 '18 at 9:09
  • It won't work for my case since I'm not using AJAX, it's a pure server side process (more like a cron job) that updates the quote. I'll have to find a way to trigger that either from server side (hopefully) or by some sort of a workaround that will do that on frontend when the page loads. – Pini Oct 7 '18 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.