Actually i created custom column in quote_item and trying to update the value once product added to the cart programmatically magento2 custom module using Model.
If Anyone have idea please guide me. Thanks in Advance.
-
i tried this link but not working magento.stackexchange.com/questions/177372/…– Hitesh BalpandeCommented Jun 10, 2019 at 13:55
-
You need this for only frontend area or want for all area.– Amit Bera ♦Commented Jun 10, 2019 at 14:18
-
@AmitBera yes i am doing it for frontend area only– Hitesh BalpandeCommented Jun 10, 2019 at 14:21
1 Answer
I suggest you use implement extension attribute for this field at here.
See how to use Extension attribute. https://devdocs.magento.com/guides/v2.3/extension-dev-guide/extension_attributes/adding-attributes.html
Make your field as an extension attribute of data interface Magento\Quote\Api\Data\CartItemInterface
Create extension_attributes.xml
at app/code/{Vendor}/{Module}/etc/
<?xml version="1.0"?>
<config>
<extension_attributes for="Magento\Quote\Api\Data\CartItemInterface">
<attribute code="{YOUR_FIELD_NAME}" type="{FIELD_TYPE}">
</attribute>
</extension_attributes>
</config>
After that you to set this field value using event checkout_cart_product_add_after