In order to achieve that first, you should modify:
details.html:
<div data-bind="text: someAction($parent)"></div>
This an entry point for debbuging. You have to find corresponding js file. In Magento\Checkout\...\web\js\...\details.js
you should add this someAction()
method. Here you can put console.log()
and searching around. I was modyfying OneStepCheckout by Magestore, but I bet you can use that (add it inside below other functions), one or make some modifications:
details.js
:
/**
* Method gets product object basing on quoteItem and quote object.
*
* @param {object} quoteItem
*
* @return {object}
*/
getProductOfQuoteItem: function(quoteItem) {
var quoteItemId = quoteItem.item_id;
var quoteItemCollection = quote.getItems();
for (var i in quoteItemCollection) {
if (quoteItemCollection[i].item_id == quoteItemId) {
return quoteItemCollection[i];
}
}
},
Here you should have product object, but it has only part of data. If you don't have information you need you can add them using observer: on sales_quote_item_set_product
and in observer you can add data more or less like this (I was adding some category data):
class addDataToQuoteItem implements ObserverInterface
{
/**
* @var \Magento\Catalog\Api\CategoryRepositoryInterface
*/
private $categoryRepository;
/**
* Di.
*
* @param \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepositoryInterface
*/
public function __construct
(
CategoryRepositoryInterface $categoryRepositoryInterface
)
{
$this->categoryRepository = $categoryRepositoryInterface;
}
/**
* Method adds custom data to every quote item object.
*
* @param \Magento\Framework\Event\Observer $observer
*/
public function execute(Observer $observer)
{
$product = $observer->getProduct();
/** @var $product \Magento\Catalog\Api\Data\ProductInterface */
$categoryIds = $product->getCategoryIds();
$quoteItem = $observer->getQuoteItem();
/** @var $quoteItem \Magento\Quote\Api\Data\CartItemInterface */
//To inject it as attribute, not using setData() you need xml, provided below
$quoteItem->setCategoryIds($product->getCategoryIds());
//That way you don't need any xml
$quoteItem->setData('categoryData', $categoryIds);
}
}
and xml if using first method in observer - etc\catalog_attributes.xml
:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/catalog_attributes.xsd">
<group name="quote_item">
<attribute name="category_ids"/>
</group>
I was doing all this on module modifing default Magento_Checkout
(aparat observer - it works on native event), so I can't promise that it will work at once, but you have some starting point to work it out.