I want SKU value of product's selected custom option on onepage.
Can somebody help me on this ?
Thank you.
Try bellow code
<?php
$options = $_item->getBuyRequest()->getData('options');
foreach ($options as $key => $value) {
$optionData = $_item->getProduct()->getOptionById($key);
if($optionData['type'] == 'drop_down') {
foreach ($optionData->getValues() as $v) {
if ($v['option_type_id'] == $value) {
echo $v->getSku();
echo "<br>";
break;
}
}
}
elseif ($optionData['type'] == 'field') {
echo $optionData['sku'];
}
}
?>