1

I have created custom field in custom option by using

custom option, custom fields

I want to get my custom option from $block->getOption();

But my custom field not added in the list ..

Thanks.

1 Answer 1

1

Try this....

$_product = $block->getProduct(); foreach ($_product->getOptions() as $o) { if ($o->getTitle() != 'Color') { // or another title of option continue; } foreach ($o->getValues() as $value) { print_r($value->getData()); } } 
4
  • I have add is_default field in custom option .... I want to default select the radio button which option values has is_default= 1..How to do this... Commented Dec 22, 2018 at 6:29
  • is_default is custom options title or value Commented Dec 22, 2018 at 6:52
  • title ......... Commented Dec 22, 2018 at 6:57
  • try this if ($o->getTitle() == 'is_default') { //your conditions continue; } Commented Dec 22, 2018 at 8:43

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.