Magento 2.4.6
I am trying to get the simple product of a configurable product when a product is added to the cart. I am listening to the checkout_cart_product_add_after
event. This is what I have so far:
$item = $observer->getEvent()->getData('quote_item');
$item = ($item->getParentItem() ? $item->getParentItem() : $item);
$logger->info('item: ' . $item->getName());
This however, always gives me the name of the configurable, not the child simple products name. No matter what I try to access, its always the data from the parent configurable. Any ideas whats wrong here?
Thanks!