I created a script to export order information into a CSV but I'm unsure on how to display the contents of the array. What I'm trying to do is capture the custom options selected for a given order and display them. I'm new to PHP so having a hard time with this. So far I was able to display just the last option from each order but not all with this...
$_options = $block->getItemOptions();
foreach ($_options as $option) {
$str = $option['label'] . ' : ' . $option['value'];
}
I then stored the value of $option into an array which when checking $array the output does contain all the selected options. I'm just unsure on how to extract the label & value of each custom option from an order to display in CSV. The below code doesn't work!
$_options = $block->getItemOptions();
foreach ($_options as $option) {
$array[] = $option;
$str = $array['label'] . ' : ' . $array['value'];
}