Merge pull request #17368 from james-allan/fix_thirdparty_coupon_calculations
Fix coupon discount calculations for third party coupon types
This commit is contained in:
commit
87c6ca5ae0
|
@ -244,7 +244,7 @@ class WC_Discounts {
|
|||
foreach ( $items_to_apply as $item ) {
|
||||
$discounted_price = $this->get_discounted_price_in_cents( $item );
|
||||
$price_to_discount = wc_remove_number_precision( ( 'yes' === get_option( 'woocommerce_calc_discounts_sequentially', 'no' ) ) ? $discounted_price : $item->price );
|
||||
$discount = wc_add_number_precision( $coupon->get_discount_amount( $price_to_discount, $item->object ) ) * $item->quantity;
|
||||
$discount = wc_add_number_precision( $coupon->get_discount_amount( $price_to_discount / $item->quantity, $item->object, true ) ) * $item->quantity;
|
||||
$discount = min( $discounted_price, $discount );
|
||||
|
||||
// Store code and discount amount per item.
|
||||
|
|
Loading…
Reference in New Issue