I have a custom HTML on cart page with some checkboxes. I am getting All the selected checkboxes in my observer "checkout_cart_update_items_before" I am able to update cart item prices in this observer.
Now on cart update I want to create these selected checkboxes as Custom option to cart items and display them with all items in cart.
Following is the code that I have tried to create Custom options.
$item->addOption(
array(
'code' => 'logo_options',
'value' => serialize($logo_positions),
)
);
if ($logoOptions = $item->getOptionByCode('logo_options')) {
$options = $item->getProductOptions();
$options['logo_options'] = unserialize($logoOptions->getValue());
item->setProductOptions($options);
}
$item->save();
Below is a screenshot of Cart.