3

We have a pdf invoices with totals displaying both prices with included and excluded tax, but without a subtotal. What we need now only on pdf invoices is to display a total when the discount (coupon code) is active. I see that this works, but not on the totals itself:

$subtotal = $item->getRowTotal() + $item->getTaxAmount() + $item->getHiddenTaxAmount()
        - $item->getDiscountAmount();  

What would be the proper way of showing this total line on PDF invoices?

1

Maybe I am wrong but I thought the orders Grand Total would include the discount also so that something like the following would give you how much the user has paid:

$order->getGrandTotal()

If this does not work you can combine the subtotal, shipping amount and then remove the discount:

$order->getSubtotal() + $order->getShippingAmount() + $order->getDiscountAmount()

Note that on orders the discount are normally stored as a negative amount

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.