I followed this link for minicart customization but i did not work for me href "I want to customize my minicart in Magento 2. I need to add 3 attributes "
I followed above link but my minicart not working as before follow above link... i just want to add sku and product id into the minicart.
<?php
namespace Matech\Minicart\Plugin; //use Magento\Quote\Model\Quote\Item;
class DefaultItem
{
public function aroundGetItemData($subject, \Closure $proceed, Item $item)
{
$data = $proceed($item);
$product = $item->getProduct();
$atts = [
'product_id' => $product->getAttributeText('product_id'),
'product_sku' => $product->getAttributeText('sku')
];
return array_merge($data, $atts);
}
}
default.html
<!-- wahaj -->
<div data-bind="html: 'SKU#: ' + item.product_sku"></div>
<div data-bind="html: 'id: ' + item.product_id"></div>
<!-- wahaj -->
<!-- <div data-bind="html: 'SKU#: ' + item.product_sku"></div>
<div data-bind="html: 'Manufacturer: ' + item.product_manufacturer"></div>
<div data-bind="html: 'Part #: ' + item.product_part_number"></div> -->
namespace Matech\Minicart\Plugin;
//use Magento\Quote\Model\Quote\Item;
class DefaultItem { public function aroundGetItemData($subject, \Closure $proceed, Item $item) { $data = $proceed($item); $product = $item->getProduct();
}
– Wahaj Moin Jul 05 '18 at 15:38