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?
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?
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];
}
}
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.