0

I am looking for a way to get the discount percent of an order, possibly from the order class or the invoice class, it would be amazing if

$order->getDiscountPercent();

worked, but it doesn't, any ideas on how I can pull the discount percent from either the order class or the invoice class?

2

As far as I know, there is no way of doing this. All discounts are calculated in $insertAnyCurrency. Therefore you have two ways, if you want this:

SalesRule

There is a $order->getCouponRuleName(). But I don't know whether this is everytime filled. With this field you can (very fuzzy) get the rules and from the rules the percentages

discount / grandtotal

You can just calculate the percentage from the discount. But this is very fuzzy too and I'm not sure, wether you need it with or without shipping and with or without tax.

| improve this answer | |

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.