11

Magento version: 2.0.0

When user add products into cart, where are they saved? $_SESSION or Database? If it is in database, which table?

2 Answers 2

24

Magento2, save cart details at Quote tables.

  • For Cart general details use quote table .
  • Carts item details at quote_item.
  • Cart items option details at quote_item_option

Additional:

  • Checkout Addressed details at quote_address.
  • Checkout payment details at quote_payment.

Magento2 use Quote module Magento_Quote (vendor/magento/module-quote) for save all Cart general,items detail,address details etc.

And Mage_Checkout module's Session Cart model make relation between user,session with Cart details

enter image description here

5
  • How do i get values from quote_address table? Oct 17, 2019 at 13:03
  • YOu have to use Magento\Quote\Model\Quote\Address or have to use quote QuoteRepository
    – Amit Bera
    Oct 17, 2019 at 13:23
  • $shippingId = $order->getShippingAddress()->getId(); $address = $objectManager->create('Magento\Quote\Model\Quote\Address')->load($shippingId); var_dump($address)->getData(); = NULL it didnt give me any data Oct 17, 2019 at 13:34
  • @AmitBera, How can I collect abandoned cart details? Please answer to the question stackoverflow.com/questions/59643279/…
    – MagentoDev
    Jan 8, 2020 at 10:38
  • @AmitBera I am facing a strange issue where on restore cart data is considered abandoned. Can you help on this?
    – Arjun
    Jul 17, 2020 at 12:08
-1

quote table is not cart. If you delete quote from DB raw by entity_id it will be restored with new entity_id. It will have all items.

Your Answer

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

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