Question

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.

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top