Changeset 1697651
- Timestamp:
- 07/17/2017 06:01:13 PM (9 years ago)
- Location:
- pepperjam-pixel/trunk
- Files:
-
- 2 edited
-
includes/class-pj-pixel.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pepperjam-pixel/trunk/includes/class-pj-pixel.php
r1691233 r1697651 357 357 $discounted_amt = 0; 358 358 359 // Product Qty 360 $_qty = intval( $item['qty'] ); 361 359 362 // Check for any coupons that apply to this item and add to data 360 363 foreach ( $this->wc_coupons_used as $wc_coupon ) { … … 365 368 } 366 369 367 // Adjust discount amount based on coupon 368 $discounted_amt += $wc_coupon->get_discount_amount( $_price ); 370 // CommerceStack: We don't have the original cart_item to give to WC_Coupon::get_discount_amount() 371 // below so it doesn't take the limit_usage_to_x_items into account. We borrow from it and 372 // take it into account ourselves here 373 if ( $wc_coupon->is_type( array( 'percent_product', 'fixed_product' ) ) && $wc_coupon->limit_usage_to_x_items != '') { 374 $limit_usage_qty = min( $wc_coupon->limit_usage_to_x_items, $_qty ); 375 $discount = ( $wc_coupon->get_discount_amount( $_price ) * $limit_usage_qty ) / $_qty; 376 } 377 else { 378 $discount = $wc_coupon->get_discount_amount( $_price ); 379 } 380 381 $discounted_amt += $discount; 369 382 } 370 371 // Product Qty372 $_qty = intval( $item['qty'] );373 383 374 384 // Add to subtotal -
pepperjam-pixel/trunk/readme.txt
r1691233 r1697651 31 31 == Changelog == 32 32 33 = 1.0.7 = 34 * Fixed bug that caused discounts limited to x items to be incorrectly reported in item price 35 33 36 = 1.0.6 = 34 37 * Fixed bug that caused cart percent discounts to be double counted in WooCommerce 3.x versions.
Note: See TracChangeset
for help on using the changeset viewer.