woocommerce_coupon_validate_user_usage_limit

woocommerce_coupon_validate_user_usage_limit

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_coupon_validate_user_usage_limit') is found 1 times:

  • /includes/class-wc-discounts.php line 663
    				$user_id = get_current_user_id();
    			}
    		}
    
    		if ( $coupon && $user_id && apply_filters( 'woocommerce_coupon_validate_user_usage_limit', $coupon->get_usage_limit_per_user() > 0, $user_id, $coupon, $this ) && $coupon->get_id() && $coupon->get_data_store() ) {
    			$data_store  = $coupon->get_data_store();
    			$usage_count = $data_store->get_usage_by_user_id( $coupon, $user_id );
    			if ( $usage_count >= $coupon->get_usage_limit_per_user() ) {
    				if ( $data_store->get_tentative_usages_for_user( $coupon->get_id(), array( $user_id ) ) > 0 ) {
    					$error_message = $coupon->get_coupon_error( WC_Coupon::E_WC_COUPON_USAGE_LIMIT_COUPON_STUCK );
    					$error_code    = WC_Coupon::E_WC_COUPON_USAGE_LIMIT_COUPON_STUCK;