0

I added a new Column on Cart Page Using this link : https://magecomp.com/blog/add-extra-new-column-on-shopping-cart-page-magento-2/ and add new field in quote_items table.

How to add this new Column on quote_items table on UpdatecartItems?

Please Check : enter image description here

enter image description here

0

using plugin di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\Cart">
        <plugin name="interceptUpdateProductToCart" type="Vendor\Module\Plugin\updateCart"/>
    </type>
</config>

updateCart.php

<?php
namespace Vendor\Module\Plugin;


class updateCart
{
    /**
     * @var \Magento\Quote\Model\Quote
     */
    protected $quote;

    /**
     * Plugin constructor.
     *
     * @param \Magento\Checkout\Model\Session $checkoutSession
     */
    public function __construct(
        \Magento\Checkout\Model\Session $checkoutSession,
    ) {
        $this->quote = $checkoutSession->getQuote();
    }

    /**
     * @param \Magento\Checkout\Model\Cart $subject
     * @param $data
     * @return array
     */
    public function beforeupdateItems(\Magento\Checkout\Model\Cart $subject,$data)
    {
        $quote = $subject->getQuote();
        $quote->setData('custom_column', $customData); // Fill your custom data

        return [$data];

    }
}
0

I Create an Module to add new input column on Cart Page at update cart that column value store in quote_items table and on Place Order automatically store in sales_order_items table.

You can fetch this Fields anywhere.

I Fetch this field in Order Summary at checkout page.

https://github.com/Naeem-Dhattiwala/NewFieldCartPage.git

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.