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.

  • Did you get any solution for this ? – manish_khot Sep 26 '17 at 13:07

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, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.