I am trying to change product image in minicart,
Used below code to achieve it.
here is the code of my di.xml file.
<type name="Magento\Checkout\CustomerData\AbstractItem">
<plugin name="Change_Product_Image_In_Minicart" type="Vendor\Module\Plugin\Minicart\Image" sortOrder="1"/>
</type>
This code i used in my plugin file Image.php
class Image
{
public function aroundGetItemData($subject, $proceed, $item){
$result = $proceed($item);
$productImage = "some image link";
$result['product_image']['src'] = $productImage;
return $result;
}
}
I am getting below erro once used above code,
PHP Parse error: syntax error, unexpected '\xc2\xa0\xc2\xa0public' (T_STRING), expecting function (T_FUNCTION), Anyone suggest what is mistake here please, }
I have fixed the issue myself, can anybody update me code for, how to change image for each item in the minicart, suppose if i have 5 items in cart, i need to change image for each of them, How can i apply for each here?