Thursday 5 June 2014

Magento – check if coupon code used:

Once on the Onepage Checkout page, I need to track if the customer has used any specific coupon code. This can be checked by the checkout session.
Use this code to hunt up the coupon code. This code will return the coupon code if used or empty result.


<?php
 $coupon_code = Mage::getSingleton('checkout/session')->getQuote()->getCouponCode();
 if($coupon_code){
      echo "coupon used";
       }
       else
       {
            echo "coupon not used";
             }
              ?>

No comments:

Post a Comment