function add_custom_js_to_checkout() {
    if ( is_checkout() && ! is_wc_endpoint_url() ) {
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function($) {
                $('#billing_phone').on('input', function() {
                    var phoneInput = $(this).val();
                    if (phoneInput.length !== 10 || !$.isNumeric(phoneInput)) {
                        $(this).addClass('input-error');
                    } else {
                        $(this).removeClass('input-error');
                    }
                });
            });
        </script>
        <?php
    }
}
ekleyip dener misin?