0

Guys i'm trying to find a code that will give me the discount amount for the current session order when i discount code is used.

Here is what i have right now but it is not working:

        $coupon = Mage::getModel('salesrule/rule');
        $couponCollection = $coupon->getCollection();
        foreach($couponCollection as $c){
            $CouponDiscount = $c->getDiscountAmount();
        }
        echo $CouponDiscount;

How can i get the amount of the discount used in the current session order ?

Thanks in advance!

1

Hi you can get a order discount amount from order field discount_amount

like this:

$order=Mage::getModel('sales/order')->load($orderid)
$order->getDiscountAmount()

for Current checkout session then try it

$totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount(); //total items in cart
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
$subtotal = round($totals["subtotal"]->getValue()); //Subtotal value
$grandtotal = round($totals["grand_total"]->getValue()); //Grandtotal value
if(isset($totals['discount'])) {
    $discount = round($totals['discount']->getValue()); //Discount value if applied
} else {
    $discount = '';
}

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.