I know the way to get the customizable options by this code below:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product
foreach ($product->getOptions() as $options) {
$optionData = $options->getValues();
foreach ($optionData as $data) {
print_r($data->getData());
echo $optionPrice[] = $data->getPrice();
echo $optionDuration[] = $data->getTitle();
}
}
But I don't know how to get the option_type_id
of that product. I want to know what option that product have selected like:
Size : 10 kg
in the select 10kg,20kg,30kg.
Best Answer
I think you are looking for
$product->getOptions()[0]->getValues()[0]->getOptionTypeId()