I'm editing app\design\frontend\Vendor\theme\Magento_Checkout\templates\cart\item\default.phtml
This is what I'm trying to achieve:
For configurable product, it shows color and size by default, but they doesn't show up for simple product.
The .phtml which I'm editing already have $product:
$product = $_item->getProduct();
I tried this:
<br>data :<?php print_r($product->getData())?>
<br>color :<?php var_dump($product->getColor())?>
<br>options :<?php var_dump($product->getOptions())?>
But it doesnt seem to have color or size value in it. Here's the output:
Best Answer
First you have to create helper class in your module
Then You can use this function in phtml file by calling helper function