WordPress at Your Fingertips
function is not described

WC_Coupon_Data_Store_CPT::increase_usage_count() public WC 3.0.0

Increase usage count for current coupon.

{} It's a method of the class: WC_Coupon_Data_Store_CPT{}

Return

Int. New usage count.

Usage

$WC_Coupon_Data_Store_CPT = new WC_Coupon_Data_Store_CPT();
$WC_Coupon_Data_Store_CPT->increase_usage_count( $coupon, $used_by, $order );
$coupon(WC_Coupon) (required) (passed by reference — &)
Coupon object.
$used_by(string)
Either user ID or billing email.
Default: ''
$order(WC_Order)
(Optional) If passed, clears the hold record associated with order.
Default: null

Changelog

Since 3.0.0 Introduced.

Code of WC_Coupon_Data_Store_CPT::increase_usage_count() WC 5.8.0

public function increase_usage_count( &$coupon, $used_by = '', $order = null ) {
	$coupon_held_key_for_user = '';
	if ( $order instanceof WC_Order ) {
		$coupon_held_key_for_user = $order->get_data_store()->get_coupon_held_keys_for_users( $order, $coupon->get_id() );
	}

	$new_count = $this->update_usage_count_meta( $coupon, 'increase' );

	if ( $used_by ) {
		$this->add_coupon_used_by( $coupon, $used_by, $coupon_held_key_for_user );
		$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;
}