How to Find Variable Name for Coupon Code and Coupon Value

couponproduct

Can anyone tell me how I can include the coupon code and value of the coupon in an Order CSV that gets sent to the order fulfillment company? I am using Magento CE 1.8.1.

Basically when an order is generated, it also generates a CSV file with the order details and uploads this to the order fulfillment company. Looking through the code I can see that it pulls in other order data from variables e.g:

    $billingAddress = $order->getBillingAddress()->toArray();
    $email = $billingAddress['email'];
    $telephone = $billingAddress['telephone'];

What would be the variable name for pulling in the name and value of any money-off coupon that happens to be used for that order? I can't see any way of finding this out.

Best Answer

For getting order coupon code used below code

$order->getCouponCode();

For Coupon description

$order->getDiscountDescription();

And Also getting order discount Price

$DiscountPrice=$order->getDiscountAmount();
Related Topic