Bu şekilde bir dosyam var ve ben bu kodları ayrı halde işleyince fonskiyonu çalıştırıyor ama bu halde tek dosyada verince en baştaki çalışıyor altındakiler çalışmıyor. Bunun sebebi nedir?

jQuery(document).ready(function ($) {
    const $checkoutForm = $('form.checkout');
    const $billingAccountType = $('#billing_account_type');
    const $contractsWrapper = $('.wc-contracts-wrapper');
    const $tcField = $('#billing_tc_number_field');
    const $taxFields = $('#billing_tax_number_field, #billing_tax_office_field');

    /**
     * Sözleşme modalını açma
     */
    $(document).on('click', '.contract-link', function (e) {
        e.preventDefault();

        const contractId = $(this).data('id');
        $.ajax({
            url: wcContracts.ajaxUrl, // AJAX URL
            type: 'POST',
            data: {
                action: 'load_contract_content',
                contract_id: contractId,
                security: wcContracts.nonce, // Nonce doğrulaması
            },
            success: function (response) {
                if (response.success) {
                    $('#wc-contract-content').html(response.data.content);
                    $('#wc-contract-content-modal').fadeIn();
                } else {
                    $contractsWrapper.html('<p>' + (response.data.message || 'Sözleşme içeriği yüklenemedi.') + '</p>');
                }
            },
            error: function (xhr, status, error) {
                console.error('AJAX Hatası:', xhr, status, error);
                $contractsWrapper.html('<p>Bir hata oluştu: ' + error + '</p>');
            },
        });
    });

    /**
     * Sözleşme modalını kapatma
     */
    $(document).on('click', '#close-contract-modal', function () {
        $('#wc-contract-content-modal').fadeOut();
    });

    /**
     * Hesap türüne göre alanları göster/gizle
     */
    const toggleFields = () => {
        const accountType = $billingAccountType.val();

        // Bireysel veya kurumsal alanları dinamik olarak göster/gizle
        $.ajax({
            url: wc_checkout_params.ajax_url, // WooCommerce'in global AJAX URL'si
            type: 'POST',
            dataType: 'json',
            data: {
                action: 'load_dynamic_fields',
                account_type: accountType,
                security: wc_checkout_params.wc_dynamic_fields_nonce,
            },
            success: function (response) {
                if (response.success) {
                    if (response.data.show_tc_field) {
                        $tcField.show();
                    } else {
                        $tcField.hide();
                    }

                    if (response.data.show_tax_fields) {
                        $taxFields.show();
                    } else {
                        $taxFields.hide();
                    }
                } else {
                    console.error(response.data.message || 'Bir hata oluştu.');
                }
            },
            error: function () {
                console.error('Ajax isteği başarısız oldu.');
            },
        });
    };

    /**
     * Hesap türüne göre sözleşmeleri yükleme
     */
    const handleAccountTypeChange = () => {
        const accountType = $billingAccountType.val();

        // Hesap türü seçilmemişse mesaj göster
        if (!accountType && wcContracts.contractType === 'different') {
            $contractsWrapper.html('<p>' + wcContracts.selectAccountTypeMessage + '</p>');
            return;
        }

        // AJAX ile sözleşme yükleme
        $.ajax({
            url: wcContracts.ajaxUrl, // WooCommerce AJAX URL'si
            type: 'POST',
            data: {
                action: 'load_contracts',
                account_type: accountType,
                security: wcContracts.nonce, // Nonce doğrulaması
            },
            success: function (response) {
                if (response.success) {
                    $contractsWrapper.html(response.data.content);
                } else {
                    $contractsWrapper.html('<p>' + (response.data.message || wcContracts.loadContractsErrorMessage) + '</p>');
                }
            },
            error: function () {
                $contractsWrapper.html('<p>' + wcContracts.ajaxErrorMessage + '</p>');
            },
        });
    };

    /**
     * Hesap türü değişikliklerini dinle ve hem alanları hem de sözleşmeleri güncelle
     */
    $billingAccountType.on('change', function () {
        toggleFields();
        handleAccountTypeChange();
    });

    // Sayfa yüklendiğinde alanları ve sözleşmeleri doğru duruma getir
    toggleFields();
    handleAccountTypeChange();
});