Through observing the event checkout_cart_product_add_after
, I was able to customize the price of the item in the cart, now I need to have an observer for customizing its subtotal calculation. What event/events need to be observed?
Is it possible to customize the calculation like $cart->setQuote()->getSubtotal()
in observer and save the quote?
And basically, can it be done through observer or plugin is the solution?
Edit:
Here is my current event:
<event name="sales_quote_collect_totals_before">
<observer name="customuitemprice" instance="vendor\code\Observer\BindUpdateItem"/>
</event>
Observer:
class BindUpdateItem implements ObserverInterface
{
public function execute(\Magento\Framework\Event\Observer $observer)
{
$quote = $observer->getQuote();
foreach ($quote->getAllItems() as $item)
{
$product = $item->getProduct();
?How change the subtotal?
}
return $this;
}
}
checkout_cart_save_before
Method. Here is the lIst of events mageplaza.com/magento-2-module-development/… Please use Observer webkul.com/blog/how-to-create-custom-observers-in-magento2quote
,quote_item
"e_address