Magento 2 how to get row total with discount?
Pregunta
Normally in Magento 2 cart page show subtotal. But I would like to get subtotal after deducting discount if any cart rules applied or coupon code applied to any product.
Solución
You can get the final row total of the item in the cart by this code
echo $_item->getRowTotal() - $_item->getDiscountAmount();
where the $_item is the Cart Quote Item
Otros consejos
With taxes and rounding penny issue:
($item->getRowTotal()-$item->getDiscountAmount()+$item->getTaxAmount()+$item->getDiscountTaxCompensationAmount())
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange