0

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.

3

1 Answer 1

3

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

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.