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 – Learing_Coder Feb 14 '17 at 5:47

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 – Learing_Coder Feb 16 '17 at 4:16
  • @PranayK I think it's better if you debug the code lines above. – Khoa TruongDinh Feb 16 '17 at 4:50

Your Answer

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

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