I want to add custom attribute to quote item called item_delete for example. This attribute it's to know if a a item can or can not be deleted from cart.

I've already created an extension_attributes.xml file with the following.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Quote\Api\Data\CartItemInterface">
    <attribute code="is_delete" type="boolean" />

Also i've a plugin:

 * @param \Magento\Quote\Model\Quote\Item\Repository $subject
 * @param \Magento\Quote\Model\Quote\Item $result
public function afterSave(\Magento\Quote\Model\Quote\Item\Repository $subject, $result){

                $newItem = ObjectManager::getInstance()->get('\Magento\Quote\Api\Data\CartItemInterface');



So i want to add "is delete" attribute to quote item api rest response.


1 Answer 1


I think you are missing out the interface and its concrete class. Please take a look at this



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.