I have tried to set a custom price for this purpose but it's getting multiplied by quantity. All I need to add an extra amount(like 50$) to each quote item after it's added to the cart. So it will be like this if have 2 products in the cart... First product Price 5.00$ qty is 10. Second Product Price 3.50$ qty is 20.
I want the calculation be like : (5.00 * 10 + 50) + (3.50 * 20 + 50) item 1 subtotal = 100. item 2 subtotal = 120. Total = 220.
For Magento 1 it was implemented in Sales_Quote_Item model in CalcRowTotal(). like this.. $baseTotal = $this->getBaseRowTotal() + $additionalCharges;
$baseTotal = $this->getBaseRowTotal() + $additionalCharges; //$additionalCharges is the custom value that i want to add. $total = $this->getStore()->convertPrice($baseTotal); $this->setRowTotal($this->getStore()->roundPrice($total)); $this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
But in Magento 2 this is not working. Can anyone help ??