On clicking on Add-to-cart, the price is added to cart, in Mini cart it shows cart subtotal and this cart subtotal is saved in the quote table database.
So my question is:
How is these cart subtotal is getting saved to database? from which file?

  • I Mean Cart subtotal, by observer is saving in database or any other way he is saving the value in quote table database Commented Feb 14, 2017 at 5:47

1 Answer 1


Take a look the Add to Cart controller vendor/magento/module-checkout/Controller/Cart/Add.php


Go to the save method: vendor/magento/module-checkout/Model/Cart.php


As we can see, Magento will use Magento\Quote\Model\QuoteRepository to save the quote with collect totals to database.

  • It is helpful,But i need to know how is cart subtotal is getting stored in quote table,above answer is close that the data is getting saved in quote table,but i need to know only where exactly the cart subtotal is saving from Commented Feb 16, 2017 at 4:16
  • @PranayK I think it's better if you debug the code lines above. Commented Feb 16, 2017 at 4:50
  • @KhoaTruongDinh If I am trying to delete item from quote item, then how to execute collect total? I have quote Id, Item id. how do I save? Commented Apr 20, 2020 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.