I have two custom options for a product. Color and Size and both are dropdowns. In product detail pages, I have to display all available colors of that product.
I tried the following code and it works. But it returns all the values of Color and Size. But I only need the color values. That is I want to select the custom options by color.
$_product = $block->getProduct();
foreach($_product->getOptions() as $o){
foreach($o->getValues() as $value){
print_r($value->getData());
}
}