Add coupon usage count hooks

These action hooks allow developers to extend functionality related to updating coupon usage counts.
This commit is contained in:
Tim Jensen 2018-05-06 07:09:59 -04:00
parent 8d6bbabc58
commit e2cc3673b2
1 changed files with 6 additions and 0 deletions

View File

@ -291,6 +291,9 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
add_post_meta( $coupon->get_id(), '_used_by', strtolower( $used_by ) );
$coupon->set_used_by( (array) get_post_meta( $coupon->get_id(), '_used_by' ) );
}
do_action( 'woocommerce_increase_coupon_usage_count', $coupon, $new_count, $used_by );
return $new_count;
}
@ -316,6 +319,9 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
$coupon->set_used_by( (array) get_post_meta( $coupon->get_id(), '_used_by' ) );
}
}
do_action( 'woocommerce_decrease_coupon_usage_count', $coupon, $new_count, $used_by );
return $new_count;
}