문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top