Coupon usage counts

This commit is contained in:
claudiulodro 2017-08-10 11:27:13 -07:00
parent f1e6fd53bd
commit 28f0431c56
1 changed files with 3 additions and 0 deletions

View File

@ -971,6 +971,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
}
}
$coupon->increase_usage_count( $this->get_user_id() );
$this->calculate_totals( true );
return true;
@ -998,6 +999,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
foreach ( $coupons as $item_id => $coupon ) {
if ( $coupon->get_code() === $code ) {
$this->remove_item( $item_id );
$coupon_object = new WC_Coupon( $code );
$coupon_object->decrease_usage_count( $this->get_user_id() );
break;
}
}