Get coupon discount for each coupon code in order (not current coupon value)
-
Hello,
How can I get the exact discount that each coupon in an order has generated? (In the WooCommerce backend, this amount is displayed as a ToolTip when hovering over the coupon code used in an order).
With the following code I can display only the used coupon codes of an order:
$order = wc_get_order($order_id); foreach($order->get_coupon_codes() as $coupon_code) { echo $coupon_code; }
To get the current coupon amount I can now do the following:
$coupon = new WC_Coupon($coupon_code); $coupon_amount = $coupon->get_amount();
But my problem is that I don’t want to get the current value of the coupon, but the exact discount that the coupon triggered when the order was generated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get coupon discount for each coupon code in order (not current coupon value)’ is closed to new replies.