Make WooCommerce Coupons Store Email as well as User ID in “User By” meta

If you notice Coupon customer usage restrictions (limit by User) not working as expected the following code (placed in your theme functions.php) may help with that.

add_action( "woocommerce_increase_coupon_usage_count", function( $coupon, $new_count, $used_by ) {
    if ( $used_by ) {
        if( is_int ( $used_by ) ){ 
            add_post_meta( $coupon->get_id(), '_used_by', get_userdata( $used_by )->user_email );
        }
    }
}, 1, 3 );