I have added an extra column, by using custom module (upgradeScheme), into the table quote. How can I save my custom value into this column when quote is created? The value I want to add to this extra column can I get from the session. I just don't know how I can save this value into the quote. Please give a step by step instruction.

If I sum up my situation, it would be,

  1. I have added an extra column in the table quote.
  2. I can get the value I want to add to the custom column from session.
  3. I know how to convert/copy data from Quote to Order.
  4. I don't know how to save my custom value to the extra column I created in Quote.

1 Answer 1


You can Use Event checkout_cart_product_add_after.

in your frontend/events.xml

<event name="checkout_cart_product_add_after">
        <observer name="after_add_to_cart" instance="your\module\Observer\AddToCartAfter" />

in observer file AddToCartAfter.php

public function execute(\Magento\Framework\Event\Observer $observer) {

    $quoteItem = ( $quoteItem->getParentItem() ? $quoteItem->getParentItem() : $quoteItem );

    $quoteItem->setCustomField("Custom Value");
    //here u set value of your field of quote

  • i want save custom value for quote_item table Jun 10, 2019 at 14:33
  • If you have any idea please guide me Jun 10, 2019 at 14:34
  • 1
    You can follow my answer for that. Jun 12, 2019 at 3:04
  • 1
    Why did you answer a question that hadn't been asked yet (Hitesh's) instead of answering the OP's question? And why did the OP accept this answer? This clearly doesn't update the quote table. My search continues... May 18, 2022 at 21:58

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.