There are 3 places to store items data in the quote:
- \Magento\Quote\Model\Quote::$_items
- \Magento\Quote\Model\Quote::$_data['items']
- \Magento\Quote\Model\Quote::$_data['items_collection']
\Magento\Quote\Model\Quote
const KEY_ITEMS = 'items';
/**
* Quote items collection
*
* @var \Magento\Eav\Model\Entity\Collection\AbstractCollection
*/
protected $_items;
public function getItems()
{
return $this->_getData(self::KEY_ITEMS);
}
public function setItems(array $items = null)
{
return $this->setData(self::KEY_ITEMS, $items);
}
public function getItemsCollection($useCache = true)
{
if ($this->hasItemsCollection()) {
return $this->getData('items_collection');
}
if (null === $this->_items) {
$this->_items = $this->_quoteItemCollectionFactory->create();
$this->extensionAttributesJoinProcessor->process($this->_items);
$this->_items->setQuote($this);
}
return $this->_items;
}
What is the right place to store items data in the quote?
Magento version: 2.1.2