Pregunta

Estoy buscando una manera de obtener el porcentaje de descuento de un pedido, posiblemente, de la clase de orden o la clase de factura, que sería increíble si

$order->getDiscountPercent();

funcionó, pero no lo hace, alguna idea de cómo puedo sacar el porcentaje de descuento ya sea de la clase de orden o la clase de factura?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top