I am trying to change the product name in the quote item via the event observer.
I followed this guide but it does not work.
public function execute(\Magento\Framework\Event\Observer $observer)
{
$item = $observer->getEvent()->getQuoteItem();
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
$item->setName('New Name');
$item->getProduct()->setIsSuperMode(true);
}
The Event:
app/code/Test/Module/etc/frontend/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="checkout_cart_product_add_after">
<observer name="dome_cart" instance="Test\Module\Observer\Option\AddCustomdOptionsToCart"/>
</event>
</config>