1

I added a new column to quote item(lets call custom_type). So I extended \Magento\Quote\Model\Cart\Totals\Item to implement getters and setters for my column.

public function getCustomType()
{
   return $this->_get('custom_type');
}

public function setCustomType($type)
{
   return $this->setData('custom_type', $type);
}

It is sufficient to get/set my new column values. It works when we get the column values. But if I try to get the value in checkout review page(#payments), the value is not returned because Magento uses REST to get the item information(missing interface signatures).

So the problem arises here. I need to add interface for these two methods in \Magento\Quote\Api\Data\TotalsItemInterface to get the values using REST. I am creating a separate module, so I can't touch the core code.

How do I achieve this? Any suggestions.

2
  • Did you find any solution? Commented Sep 12, 2016 at 8:00
  • Not found the solution. But found a way - extension attributes.
    – Mike
    Commented Sep 13, 2016 at 6:38

1 Answer 1

1

Finally, answering my own question. We have to use extensions attributes to achieve this. We have to access our custom attribute through extension attributes which is available in the respective interfaces. Hope it guides someone.

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.