I am trying to create extension attribute to quote_item table but in module-quote I haven't seen any QuoteItemInterface, but there is CartItemInterface. I tried with that


<?xml version="1.0"?>
    <extension_attributes for="Magento\Quote\Api\Data\CartItemInterface">
        <attribute code="sample_field" type="string">

but not working , how can I set and get extension attributes to quote_item table ? How can I check the field is created or not ?


1 Answer 1


You should see getters and setters for your sample_field in generated folder. See Magento\Quote\Api\Data\CartExtensionInterface. Its generated automatically. Also when you implement extension attributes, be aware that you persist the data yourself. To add this attribute to the entity you should figure out a way to load your value. Best approach is to use plugins or events

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.