I want to create new custom option for quote item in my observer. How can I do that? Here is my code:
public function execute(\Magento\Framework\Event\Observer $observer) {
$item = $observer->getEvent()->getData('quote_item');
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
$price = '100'; //set your price here
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
$item->getProduct()->setIsSuperMode(true);
}
I am setting custom price but I also need to set some custom options. I have created observer on checkout_cart_product_add_after event.