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:
Mike Jolley 2017-10-26 14:23:31 +01:00 committed by GitHub
commit 87c6ca5ae0
1 changed files with 1 additions and 1 deletions

View File

@ -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.